From ece2721e267bf49582c0a053903656b29d28a236 Mon Sep 17 00:00:00 2001 From: Josh Everett <44347292+MrJoshE@users.noreply.github.com> Date: Thu, 20 Apr 2023 16:08:04 +0100 Subject: [PATCH] Updated baseurl for delete notifications --- src/pages/notifications/notifications.js | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/pages/notifications/notifications.js b/src/pages/notifications/notifications.js index 01f7490..1650c1a 100644 --- a/src/pages/notifications/notifications.js +++ b/src/pages/notifications/notifications.js @@ -33,20 +33,8 @@ const NotificationsPage = () => { throw new Error("Failed to fetch notifications"); } const data = await response.json(); - // const data = [ - // { - // _id: "1", - // title: "Booked another parking space", - // description: "booked at this area", - // date: "2023-04-20T07:59:52.289Z", - // }, - // { - // _id: "2", - // title: "Booked space", - // description: "booked this area", - // date: "2023-04-20T07:59:52.289Z", - // }, - // ]; + + setNotifications(data); setLoading(false); } catch (error) { @@ -57,7 +45,7 @@ const NotificationsPage = () => { const deleteNotification = async (notificationId) => { try { - const response = await fetch(`/api/notifications/delete/${notificationId}`, { + const response = await fetch(`${baseUrl}/notification/delete/${notificationId}`, { method: "DELETE", headers: { Authorization: `Bearer ${localStorage.getItem("token")}`, @@ -90,7 +78,7 @@ const NotificationsPage = () => { const clearAllNotifications = async () => { // make a request to the notifications microservice to clear all notifications try { - const response = await fetch(`/api/notifications/delete/all/`, { + const response = await fetch(`${baseUrl}/notification/delete/all/`, { method: "DELETE", headers: { Authorization: `Bearer ${localStorage.getItem("token")}`, -- GitLab