Skip to content
Snippets Groups Projects
Commit 0d9c6760 authored by Martins, Laurent's avatar Martins, Laurent
Browse files

fix #416 : exception à la première connexion

parent 54ccc315
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,14 @@ import { environment } from '../../../../../environments/environment';
Mes notifications
</a>
</li>
} @else {
<li>
<a routerLink="/notifications"
class="fr-btn fr-icon-notification-3-line"
[title]="'Notifications'+wording.LINK_TITLE">
Mes notifications
</a>
</li>
}
<li>
<a class="fr-btn fr-icon-lock-line" (click)="logout()"
......
......@@ -10,9 +10,15 @@ import { Notification } from "./notification";
export class NotificationService {
private readonly http = inject(HttpClient);
private readonly url = `${environment.BASE_API}/notifications`;
notifications$ = this.http.get<Array<Notification>>(this.url, { withCredentials: true }).pipe(
shareReplay({ bufferSize: 1, refCount: true })
);
notifications$ = new Promise<Array<Notification>>(resolve => {
setTimeout(() => {
this.http.get<Array<Notification>>(this.url, { withCredentials: true })
.pipe(
shareReplay({ bufferSize: 1, refCount: true })
)
.subscribe(notifications => resolve(notifications));
}, 1000);
});
public markAsRead = (notification: Notification) => {
notification.visible = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment