{
this.successMessage('Succès', `Auteur ${author.name} créé avec succès`);
this.createdAuthor.emit(author);
diff --git a/src/app/components/update-profile-form/update-profile-form.component.ts b/src/app/components/update-profile-form/update-profile-form.component.ts
index 6900917..469c5e8 100644
--- a/src/app/components/update-profile-form/update-profile-form.component.ts
+++ b/src/app/components/update-profile-form/update-profile-form.component.ts
@@ -7,7 +7,6 @@ import {Subscription, switchMap} from 'rxjs';
import {AuthorService} from '../../services/author.service';
import {MessageService} from 'primeng/api';
import {FileSelectEvent, FileUploadModule} from 'primeng/fileupload';
-import {CookieService} from 'ngx-cookie-service';
import {Author} from '../../models/author';
import {Router} from '@angular/router';
import {AuthService} from '../../auth.service';
@@ -38,7 +37,6 @@ export class UpdateProfileFormComponent implements OnDestroy {
constructor(private formBuilder: FormBuilder,
private authorService: AuthorService,
private messageService: MessageService,
- private cookieService: CookieService,
private authService: AuthService,
private router: Router,
) {
@@ -80,7 +78,7 @@ export class UpdateProfileFormComponent implements OnDestroy {
}
onSubmit() {
- const token: string = this.authService.getAuthenticatedAuthorToken();
+ const token = this.authService.getAuthenticatedAuthorToken();
if (this.form.valid && token && this.password === this.passwordConfirm) {
const newUsername = this.form.value.username;
if (this.uploadedFile) {
@@ -92,7 +90,7 @@ export class UpdateProfileFormComponent implements OnDestroy {
next: (author: Author) => {
this.successMessage("Mise à jour réussie", "Profil mit à jour avec succès");
this.updatedAuthorEvent.emit(author);
- this.cookieService.set('author', JSON.stringify(author));
+ sessionStorage.setItem('author', JSON.stringify(author));
this.router.navigate(['/']);
},
error: (err) => {
@@ -104,7 +102,7 @@ export class UpdateProfileFormComponent implements OnDestroy {
next: (author: Author) => {
this.successMessage("Mise à jour réussie", "Profil mit à jour avec succès");
this.updatedAuthorEvent.emit(author);
- this.cookieService.set('author', JSON.stringify(author));
+ sessionStorage.setItem('author', JSON.stringify(author));
this.router.navigate(['/']);
},
error: (err) => {
diff --git a/src/app/guards/admin.guard.ts b/src/app/guards/admin.guard.ts
index 5e90c8d..f9ac1b4 100644
--- a/src/app/guards/admin.guard.ts
+++ b/src/app/guards/admin.guard.ts
@@ -1,17 +1,13 @@
import {CanActivateFn, Router} from '@angular/router';
import {inject} from '@angular/core';
-import {CookieService} from 'ngx-cookie-service';
import {AuthService} from '../auth.service';
import {Role} from '../models/role';
export const adminGuard: CanActivateFn = (route, state) => {
const router = inject(Router);
- const cookieService = inject(CookieService);
const authService: AuthService = inject(AuthService);
-
- if ((authService.isAuthenticated() && JSON.parse(cookieService.get("author")).role !== Role.ADMIN) || !authService.isAuthenticated()) {
+ if ((authService.isAuthenticated() && JSON.parse(sessionStorage.getItem("author")!).role !== Role.ADMIN) || !authService.isAuthenticated()) {
router.navigate(['/']);
}
-
return true;
};
diff --git a/src/app/guards/auth.guard.ts b/src/app/guards/auth.guard.ts
index 0d4456a..de721de 100644
--- a/src/app/guards/auth.guard.ts
+++ b/src/app/guards/auth.guard.ts
@@ -1,11 +1,9 @@
import {CanActivateFn, Router} from '@angular/router';
import {inject} from '@angular/core';
-import {CookieService} from 'ngx-cookie-service';
export const authGuard: CanActivateFn = (route, state) => {
const router = inject(Router);
- const cookieService = inject(CookieService);
- if (cookieService.check("author") || cookieService.check("token")) {
+ if (sessionStorage.getItem("author") !== null || sessionStorage.getItem("token") !== null) {
router.navigate(['/']);
}
diff --git a/src/app/guards/writer.guard.ts b/src/app/guards/writer.guard.ts
index ad596bd..176e691 100644
--- a/src/app/guards/writer.guard.ts
+++ b/src/app/guards/writer.guard.ts
@@ -1,17 +1,18 @@
import {CanActivateFn, Router} from '@angular/router';
import {inject} from '@angular/core';
-import {CookieService} from 'ngx-cookie-service';
import {AuthService} from '../auth.service';
import {Role} from '../models/role';
export const writerGuard: CanActivateFn = (route, state) => {
const router = inject(Router);
- const cookieService = inject(CookieService);
const authService = inject(AuthService);
+ const authorStr = sessionStorage.getItem("author");
- if ((authService.isAuthenticated() && JSON.parse(cookieService.get("author")).role !== Role.WRITER) || !authService.isAuthenticated()) {
- router.navigate(['/']);
+ if (authorStr) {
+ if ((authService.isAuthenticated() && JSON.parse(authorStr).role !== Role.WRITER) || !authService.isAuthenticated()) {
+ router.navigate(['/']);
+ }
+ return true;
}
-
- return true;
+ return false;
};
diff --git a/src/app/pages/admin-authors/admin-authors.component.html b/src/app/pages/admin-authors/admin-authors.component.html
index 846d948..7a4bb0a 100644
--- a/src/app/pages/admin-authors/admin-authors.component.html
+++ b/src/app/pages/admin-authors/admin-authors.component.html
@@ -33,7 +33,7 @@
{{ author.role }}
-
diff --git a/src/app/pages/home/home.component.html b/src/app/pages/home/home.component.html
index b009070..c955c3e 100644
--- a/src/app/pages/home/home.component.html
+++ b/src/app/pages/home/home.component.html
@@ -13,6 +13,6 @@
[authorProfilePicture]="post.authorProfilePicture"/>
}
} @else {
- Aucun post n'a été créé pour l'instant
+
}
diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts
index 1aa49d1..6dd83fa 100644
--- a/src/app/pages/home/home.component.ts
+++ b/src/app/pages/home/home.component.ts
@@ -8,6 +8,7 @@ import {PostService} from '../../services/post.service';
import {PostHomeComponent} from '../../components/post-home/post-home.component';
import {AuthorWithPost} from '../../models/author-with-post';
import {AuthService} from '../../auth.service';
+import {LoadingComponent} from '../../components/loading/loading.component';
@Component({
selector: 'app-home',
@@ -17,6 +18,7 @@ import {AuthService} from '../../auth.service';
HeaderComponent,
ToastModule,
PostHomeComponent,
+ LoadingComponent,
],
templateUrl: './home.component.html',
styleUrl: './home.component.css'
@@ -29,9 +31,9 @@ export class HomeComponent implements OnDestroy {
constructor(
private postService: PostService,
private authService: AuthService) {
-
- if (!(this.authService.isSessionExpired()) && this.authService.isAuthenticated()) {
- this.actualAuthor = this.authService.getAuthenticatedAuthor();
+ const authenticatedAuthor = this.authService.getAuthenticatedAuthor();
+ if (!(this.authService.isSessionExpired()) && this.authService.isAuthenticated() && authenticatedAuthor) {
+ this.actualAuthor = authenticatedAuthor;
} else {
this.authService.checkSessionExpiration();
}
diff --git a/src/app/pages/login/login.component.html b/src/app/pages/login/login.component.html
index 5cf79e8..c8c934e 100644
--- a/src/app/pages/login/login.component.html
+++ b/src/app/pages/login/login.component.html
@@ -5,10 +5,7 @@
Nom d'utilisateur
Mot de passe
-
- Confirmez le mot de passe
-
+
{
- this.cookieService.delete('token', '/', this.configurationService.getDomain())
- this.cookieService.set("token", tokenObj.token, {
- domain: this.configurationService.getDomain(),
- secure: true,
- path: '/'
+ this.subs.push
+ (
+ this.authorService.login(this.name, this.password).pipe(
+ switchMap((tokenObj: any) => {
+ // sessionStorage.removeItem('token');
+ sessionStorage.setItem('token', tokenObj.token);
+ return this.authorService.me(tokenObj.token)
+ }))
+ .subscribe({
+ next: (author: Author) => {
+ // sessionStorage.removeItem('author');
+ sessionStorage.setItem('author', JSON.stringify(author));
+ sessionStorage.setItem('token-expiration-date', DateTime.now().plus({millisecond: this.configurationService.getTokenTTL()}).toISO())
+ this.getAuthorCookie();
+ this.router.navigate(['/']).then(() => {
+ this.successMessage('Connecté avec succès', 'Heureux de vous revoir ' + this.actualAuthor?.name)
});
- return this.authorService.me(tokenObj.token)
- }))
- .subscribe({
- next: (author: Author) => {
- this.cookieService.delete('author', '/', this.configurationService.getDomain())
- this.cookieService.set("author", JSON.stringify(author), {
- domain: this.configurationService.getDomain(),
- secure : true,
- path: '/' });
- this.cookieService.set('token-expiration-date', DateTime.now().plus({millisecond: this.configurationService.getTokenTTL()}).toISO(), {
- domain: this.configurationService.getDomain(),
- secure: true,
- path: '/',
- })
- this.getAuthorCookie();
- this.router.navigate(['/']).then(() => {
- this.successMessage('Connecté avec succès', 'Heureux de vous revoir ' + this.actualAuthor?.name)
- });
- },
- error: (err) => this.failureMessage('Erreur de connexion', err.error.message)
- })
- );
- } else {
- this.failureMessage('Erreur de connexion', 'Les deux mots de passe ne correspondent pas')
- }
+ },
+ error: (err) => this.failureMessage('Erreur de connexion', err.error.message)
+ })
+ );
}
getAuthorCookie(): void {
- this.actualAuthor = JSON.parse(this.cookieService.get("author"));
+ const authorStr = sessionStorage.getItem('author');
+ if (authorStr) {
+ this.actualAuthor = JSON.parse(authorStr);
+ }
}
successMessage(summary: string, detail: string): void {
diff --git a/src/app/pages/logout/logout.component.ts b/src/app/pages/logout/logout.component.ts
index b27b7d3..cf4634e 100644
--- a/src/app/pages/logout/logout.component.ts
+++ b/src/app/pages/logout/logout.component.ts
@@ -1,9 +1,7 @@
import {Component, OnInit} from '@angular/core';
-import {CookieService} from 'ngx-cookie-service';
import {HeaderComponent} from '../../components/header/header.component';
import {Router} from '@angular/router';
import {MessageService} from 'primeng/api';
-import {ConfigurationService} from '../../configuration.service';
@Component({
selector: 'app-logout',
@@ -14,19 +12,16 @@ import {ConfigurationService} from '../../configuration.service';
templateUrl: './logout.component.html',
styleUrl: './logout.component.css'
})
-export class LogoutComponent implements OnInit{
+export class LogoutComponent implements OnInit {
+
+ constructor(private messageService: MessageService,
+ private router: Router) {
+ }
- constructor(private cookieService: CookieService,
- private messageService: MessageService,
- private router: Router,
- private configurationService: ConfigurationService,) { }
ngOnInit(): void {
- const routes: string[] = ['/', '/login', '/register', '/logout', '/profile', '/post', '/new-post', '/admin']
- Object.keys(this.cookieService.getAll()).forEach(key => {
- routes.forEach(route => {
- this.cookieService.delete(key, route, this.configurationService.getDomain());
- })
- });
+ sessionStorage.removeItem("author");
+ sessionStorage.removeItem("token");
+ sessionStorage.removeItem("token-expiration-date");
this.router.navigate(['/']).then(() => this.successMessage('Déconnexion', 'Vous avez été deconnecté avec succès'));
}
diff --git a/src/app/pages/my-posts/my-posts.component.html b/src/app/pages/my-posts/my-posts.component.html
index cde8d1f..dc8118e 100644
--- a/src/app/pages/my-posts/my-posts.component.html
+++ b/src/app/pages/my-posts/my-posts.component.html
@@ -23,29 +23,10 @@
{{ post.publicationDate | date: "dd/MM/yyyy à HH:mm" }}
{{ post.description }}
-
-
-
-
+
-
-
-
-
+
this.actualAuthor!.profilePicture = avatar);
+ }
this.updatePosts();
}
@@ -59,8 +65,9 @@ export class MyPostsComponent implements OnDestroy {
}
updatePosts(): void {
- if (!(this.authService.isSessionExpired()) && this.authService.isAuthenticated()) {
- this.authorService.getAuthorsPosts(this.actualAuthor?.id, this.authService.getAuthenticatedAuthorToken()).subscribe({
+ const authorToken = this.authService.getAuthenticatedAuthorToken()
+ if (!(this.authService.isSessionExpired()) && this.authService.isAuthenticated() && authorToken) {
+ this.authorService.getAuthorsPosts(this.actualAuthor?.id, authorToken).subscribe({
next: posts => this.posts = posts,
error: error => this.failureMessage("Erreur", error.error.message),
}
@@ -71,13 +78,16 @@ export class MyPostsComponent implements OnDestroy {
}
deletePost(id: bigint, rowIndex: number) {
- this.postService.deletePost(id, this.authService.getAuthenticatedAuthorToken()).subscribe({
- next: (_) => {
- this.updatePosts()
- this.successMessage("Post supprimé", "Ce post a été supprimé avec succès")
- },
- error: error => this.failureMessage("Erreur", error.error.message),
- });
+ const authorToken = this.authService.getAuthenticatedAuthorToken()
+ if (authorToken) {
+ this.postService.deletePost(id, authorToken).subscribe({
+ next: (_) => {
+ this.updatePosts()
+ this.successMessage("Post supprimé", "Ce post a été supprimé avec succès")
+ },
+ error: error => this.failureMessage("Erreur", error.error.message),
+ });
+ }
this.closeDialog(this.deleteDialogVisibility, rowIndex)
}
@@ -91,6 +101,24 @@ export class MyPostsComponent implements OnDestroy {
});
}
+ openDialogPreview(post: Post): void {
+ const modalInstance = this.viewContainer.createComponent(PreviewModalComponent);
+ modalInstance.setInput("post", post)
+ modalInstance.setInput("username", this.actualAuthor?.name)
+ modalInstance.setInput("profilePicture", this.actualAuthor?.profilePicture)
+ }
+
+ openDialogUpdate(post: Post): void {
+ const modalInstance = this.viewContainer.createComponent(UpdateModalComponent);
+ modalInstance.setInput("post", post)
+ modalInstance.instance.updatedPost.subscribe(post => {
+ console.log(this.posts.map(a => a.id).indexOf(post.id))
+ this.posts[this.posts.map(a => a.id).indexOf(post.id)] = post
+ this.posts = [... this.posts]
+ modalInstance.destroy();
+ });
+ }
+
openDialog(dialogBooleanTab: boolean[], index: number) {
dialogBooleanTab[index] = true;
}
diff --git a/src/app/pages/new-post/new-post.component.ts b/src/app/pages/new-post/new-post.component.ts
index 98c3cd6..00c7bde 100644
--- a/src/app/pages/new-post/new-post.component.ts
+++ b/src/app/pages/new-post/new-post.component.ts
@@ -2,7 +2,6 @@ import {Component, EventEmitter, OnDestroy} from '@angular/core';
import {HeaderComponent} from '../../components/header/header.component';
import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
import {InputTextModule} from 'primeng/inputtext';
-import {InputTextareaModule} from 'primeng/inputtextarea';
import {FileSelectEvent, FileUploadModule} from 'primeng/fileupload';
import {mergeMap, Subscription} from 'rxjs';
import {PostService} from '../../services/post.service';
@@ -21,7 +20,6 @@ import {AuthService} from '../../auth.service';
HeaderComponent,
ReactiveFormsModule,
InputTextModule,
- InputTextareaModule,
FileUploadModule,
EditorModule,
PostFormComponent,
@@ -30,7 +28,6 @@ import {AuthService} from '../../auth.service';
styleUrl: './new-post.component.css'
})
export class NewPostComponent implements OnDestroy {
- isSessionExpired: EventEmitter = new EventEmitter();
subs: Subscription[] = []
actualAuthor: Author | undefined;
uploadedFile: File | undefined;
@@ -40,7 +37,7 @@ export class NewPostComponent implements OnDestroy {
private postService: PostService,
private authorService: AuthorService,
private messageService: MessageService,
- private authService : AuthService,
+ private authService: AuthService,
private router: Router) {
this.form = this.formBuilder.group({
description: ['', [Validators.required, Validators.maxLength(512)]],
@@ -49,7 +46,10 @@ export class NewPostComponent implements OnDestroy {
category: ['', [Validators.required, Validators.maxLength(50)]],
});
if (!(this.authService.isSessionExpired()) && this.authService.isAuthenticated()) {
- this.actualAuthor = this.authService.getAuthenticatedAuthor();
+ const authenticatedAuthor = this.authService.getAuthenticatedAuthor();
+ if (authenticatedAuthor) {
+ this.actualAuthor = authenticatedAuthor;
+ }
} else {
this.authService.checkSessionExpiration();
}
@@ -72,26 +72,31 @@ export class NewPostComponent implements OnDestroy {
category: formData.category as string
};
- this.subs.push(
- this.postService.createPost(postToPost, this.authService.getAuthenticatedAuthorToken()).pipe(
- mergeMap(post =>
- this.authorService.attributePost(this.actualAuthor?.id, post.id, this.authService.getAuthenticatedAuthorToken()).pipe(
- mergeMap((_) =>
- this.postService.changeIllustration(post.id, this.uploadedFile, this.authService.getAuthenticatedAuthorToken()),
+ const authenticatedAuthor = this.authService.getAuthenticatedAuthorToken();
+ if (authenticatedAuthor) {
+ this.subs.push(
+ this.postService.createPost(postToPost, authenticatedAuthor).pipe(
+ mergeMap(post =>
+ this.authorService.attributePost(this.actualAuthor?.id, post.id, authenticatedAuthor).pipe(
+ mergeMap((_) =>
+ this.postService.changeIllustration(post.id, this.uploadedFile, authenticatedAuthor),
+ )
)
)
- )
- ).subscribe({
- next: () => {
- this.router.navigate(['/']).then(() => {
- this.successMessage('Succès', 'Post créé avec succès')
- });
- },
- error: (err) => {
- this.failureMessage('Erreur', err.error.message);
- }
- })
- );
+ ).subscribe({
+ next: () => {
+ this.router.navigate(['/']).then(() => {
+ this.successMessage('Succès', 'Post créé avec succès')
+ });
+ },
+ error: (err) => {
+ this.failureMessage('Erreur', err.error.message);
+ }
+ })
+ );
+ } else {
+ console.error("Profil mal chargé")
+ }
}
}
diff --git a/src/app/pages/post/post.component.css b/src/app/pages/post/post.component.css
index b9e602f..88f8232 100644
--- a/src/app/pages/post/post.component.css
+++ b/src/app/pages/post/post.component.css
@@ -58,16 +58,6 @@ em {
}
}
-.commentaires {
- margin: auto;
- width: 45%;
- display: flex;
- align-items: center;
- gap: 2rem;
- flex-direction: column;
- margin-top: 5rem;
-}
-
.delete-dialog {
display: flex;
justify-content: center;
@@ -75,10 +65,48 @@ em {
gap: 3em;
}
-.comment-div {
+.commentaires {
+ margin: auto;
+ margin-top: 5rem;
+ width: 45%;
display: flex;
- align-items: center;
- gap: 1rem;
+ flex-direction: column;
+ gap: 2.5rem;
+ padding: 0 1rem;
}
+.comment-div {
+ display: flex;
+ align-items: flex-start;
+ gap: 1rem;
+ background-color: #f9f9f9;
+ padding: 1rem;
+ border-radius: 12px;
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
+ flex-wrap: wrap;
+ position: relative;
+}
+
+@media screen and (max-width: 1200px) {
+ .body-content,
+ .commentaires {
+ width: 95%;
+ }
+
+ .comment-div {
+ flex-direction: column;
+ align-items: flex-start;
+ }
+
+ .comment-meta-header {
+ flex-direction: column;
+ align-items: flex-start;
+ }
+
+ .delete-button {
+ position: static;
+ align-self: flex-end;
+ margin-top: 0.5rem;
+ }
+}
diff --git a/src/app/pages/post/post.component.ts b/src/app/pages/post/post.component.ts
index 07d87e2..97882f4 100644
--- a/src/app/pages/post/post.component.ts
+++ b/src/app/pages/post/post.component.ts
@@ -49,7 +49,12 @@ export class PostComponent {
private authService: AuthService,) {
this.route.paramMap.subscribe(params => {
if (!(this.authService.isSessionExpired()) && this.authService.isAuthenticated()) {
- this.actualAuthor = this.authService.getAuthenticatedAuthor();
+ const authenticatedAuthor = this.authService.getAuthenticatedAuthor();
+ if (authenticatedAuthor) {
+ this.actualAuthor = authenticatedAuthor;
+ } else {
+ console.error('Profil mal chargé');
+ }
} else {
this.authService.checkSessionExpiration();
}
@@ -63,15 +68,8 @@ export class PostComponent {
next: res => {
res.post.body = res.post.body.replace(/ /g, ' ')
this.concernedPost = res.post;
- this.sortCommentList(res.comment)
- this.comments = res.comment.sort((a, b) => {
- if (a.commentDate > b.commentDate) {
- return -1
- } else if (a.commentDate < b.commentDate) {
- return 1
- }
- return 0
- });
+ this.comments = res.comment
+ this.sortCommentList()
this.comments.forEach(comment => this.commentDeleteDialogMap.set(comment.id, false));
},
error: err => this.failureMessage("Erreur", err.error.message)
@@ -85,7 +83,8 @@ export class PostComponent {
addNewCommentToList(comment: Comment) {
this.comments.push(comment);
- this.sortCommentList(this.comments);
+ console.log(this.comments)
+ this.sortCommentList();
}
setCommentDialogVisible(commentId: bigint) {
@@ -113,15 +112,15 @@ export class PostComponent {
}
}
- sortCommentList(comments: Comment[]) {
- comments.sort((a, b) => {
+ sortCommentList() {
+ this.comments = this.comments.sort((a, b) => {
if (a.commentDate > b.commentDate) {
return -1
} else if (a.commentDate < b.commentDate) {
return 1
}
return 0
- })
+ });
}
successMessage(summary: string, detail: string): void {
diff --git a/src/app/pages/profile/profile.component.html b/src/app/pages/profile/profile.component.html
index cd066c9..4d86dbc 100644
--- a/src/app/pages/profile/profile.component.html
+++ b/src/app/pages/profile/profile.component.html
@@ -17,7 +17,6 @@
}
-
@if (actualAuthor) {
@if (concernedAuthor.id === actualAuthor.id) {
@@ -30,5 +29,5 @@
} @else {
- Loading...
+
}
diff --git a/src/app/pages/profile/profile.component.ts b/src/app/pages/profile/profile.component.ts
index ad47caf..84d88a2 100644
--- a/src/app/pages/profile/profile.component.ts
+++ b/src/app/pages/profile/profile.component.ts
@@ -10,6 +10,7 @@ import {Button} from 'primeng/button';
import {DialogModule} from 'primeng/dialog';
import {UpdateProfileFormComponent} from '../../components/update-profile-form/update-profile-form.component';
import {AuthService} from '../../auth.service';
+import {LoadingComponent} from '../../components/loading/loading.component';
@Component({
selector: 'app-profile',
@@ -21,6 +22,7 @@ import {AuthService} from '../../auth.service';
Button,
DialogModule,
UpdateProfileFormComponent,
+ LoadingComponent,
],
templateUrl: './profile.component.html',
styleUrl: './profile.component.css'
@@ -31,7 +33,6 @@ export class ProfileComponent implements OnDestroy {
authorName: string = "";
subs: Subscription[] = [];
updateProfileDialog: boolean = false;
- changePasswordDialog: boolean = false;
constructor(private route: ActivatedRoute,
private authorService: AuthorService,
@@ -43,7 +44,12 @@ export class ProfileComponent implements OnDestroy {
}));
})
if (!(this.authService.isSessionExpired()) && this.authService.isAuthenticated()) {
- this.actualAuthor = this.authService.getAuthenticatedAuthor();
+ const authenticatedAuthor = this.authService.getAuthenticatedAuthor();
+ if (authenticatedAuthor) {
+ this.actualAuthor = authenticatedAuthor;
+ } else {
+ console.error("Profil mal chargé");
+ }
} else {
this.authService.checkSessionExpiration();
}
diff --git a/src/app/preset.ts b/src/app/preset.ts
new file mode 100644
index 0000000..f40e495
--- /dev/null
+++ b/src/app/preset.ts
@@ -0,0 +1,21 @@
+import {definePreset} from '@primeng/themes';
+import Aura from '@primeng/themes/aura';
+
+
+export const myPreset = definePreset(Aura, {
+ semantic: {
+ primary: {
+ 50: '{indigo.50}',
+ 100: '{indigo.100}',
+ 200: '{indigo.200}',
+ 300: '{indigo.300}',
+ 400: '{indigo.400}',
+ 500: '{indigo.500}',
+ 600: '{indigo.600}',
+ 700: '{indigo.700}',
+ 800: '{indigo.800}',
+ 900: '{indigo.900}',
+ 950: '{indigo.950}'
+ }
+ }
+});
diff --git a/src/app/services/author.service.ts b/src/app/services/author.service.ts
index a594b7f..910b955 100644
--- a/src/app/services/author.service.ts
+++ b/src/app/services/author.service.ts
@@ -62,6 +62,11 @@ export class AuthorService {
}
}
+ getAvatar(id: string): Observable {
+ return this.httpClient.get(`${this.apiUrl}/${id}/avatar`, { responseType: 'text' });
+ }
+
+
getAuthor(id: string | null): Observable {
if (id) {
return this.httpClient.get(`${this.apiUrl}/${id}`);
@@ -89,6 +94,14 @@ export class AuthorService {
'Authorization': `Bearer ${token}`
})
}
- return this.httpClient.post(`${this.apiUrl}/register/admin`, {name: username, password: password, role: role}, httpOptions);
+ return this.httpClient.post(`${this.apiUrl}/register/admin`, {
+ name: username,
+ password: password,
+ role: role
+ }, httpOptions);
+ }
+
+ getAuthorAvatar(id: string) {
+ return this.httpClient.get(`${this.apiUrl}/${id}/avatar`);
}
}
diff --git a/src/assets/icon.png b/src/assets/icon.png
new file mode 100644
index 0000000..b511a7f
Binary files /dev/null and b/src/assets/icon.png differ
diff --git a/src/index.html b/src/index.html
index 127cabd..bb90503 100644
--- a/src/index.html
+++ b/src/index.html
@@ -6,10 +6,12 @@
A BON ENTENDEUR
-
+
+
+
-
+