From cce651eef9b11c28d25f636b11cb2b5071fcd34a Mon Sep 17 00:00:00 2001 From: Eduardo Lopes <155753879+eduardolopesx03@users.noreply.github.com> Date: Thu, 22 Jan 2026 16:06:41 -0300 Subject: [PATCH] =?UTF-8?q?Corrige=20base=20da=20API=20de=20notifica=C3=A7?= =?UTF-8?q?=C3=B5es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/services/notifications.service.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index a2ba36a..2852737 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -23,15 +23,18 @@ export type NotificationDto = { @Injectable({ providedIn: 'root' }) export class NotificationsService { - private readonly baseUrl = `${environment.apiUrl}/notifications`; + private readonly baseApi: string; - constructor(private http: HttpClient) {} + constructor(private http: HttpClient) { + const raw = (environment.apiUrl || '').replace(/\/+$/, ''); + this.baseApi = raw.toLowerCase().endsWith('/api') ? raw : `${raw}/api`; + } list(): Observable { - return this.http.get(this.baseUrl); + return this.http.get(`${this.baseApi}/notifications`); } markAsRead(id: string): Observable { - return this.http.patch(`${this.baseUrl}/${id}/read`, {}); + return this.http.patch(`${this.baseApi}/notifications/${id}/read`, {}); } }