diff --git a/src/utils/events/createEvent.js b/src/utils/events/createEvent.js index 764d419..27da6b1 100644 --- a/src/utils/events/createEvent.js +++ b/src/utils/events/createEvent.js @@ -1,5 +1,5 @@ -import fetchWrapper from "../fetchWrapper.js"; -import getXSRFToken from "../getXSRF.js"; +import fetchWrapper from "../fetchWrapper"; +import getXSRFToken from "../getXSRF"; export default async function createEvent(name, description, start, end) { const csrfToken = await getXSRFToken(); diff --git a/src/utils/events/deleteEvent.js b/src/utils/events/deleteEvent.js index 10c8a49..2781e91 100644 --- a/src/utils/events/deleteEvent.js +++ b/src/utils/events/deleteEvent.js @@ -1,5 +1,5 @@ -import fetchWrapper from "../fetchWrapper.js"; -import getXSRFToken from "../getXSRF.js"; +import fetchWrapper from "../fetchWrapper"; +import getXSRFToken from "../getXSRF"; export default async function deleteEvent(eventId) { const csrfToken = await getXSRFToken(); diff --git a/src/utils/events/getAllEvents.js b/src/utils/events/getAllEvents.js index b35f979..79bfc67 100644 --- a/src/utils/events/getAllEvents.js +++ b/src/utils/events/getAllEvents.js @@ -1,4 +1,4 @@ -import fetchWrapper from "../fetchWrapper.js"; +import fetchWrapper from "../fetchWrapper"; export default async function getAllEvents() { return fetchWrapper("/api/events/", null, "GET"); diff --git a/src/utils/events/getEventById.js b/src/utils/events/getEventById.js index 97d6272..0b41625 100644 --- a/src/utils/events/getEventById.js +++ b/src/utils/events/getEventById.js @@ -1,4 +1,4 @@ -import fetchWrapper from "../fetchWrapper.js"; +import fetchWrapper from "../fetchWrapper"; export default async function GetEventById(id) { return fetchWrapper(`/api/events/${id}`, null, "GET"); diff --git a/src/utils/getRoles.ts b/src/utils/getRoles.ts index 99cadb6..fd8d0d4 100644 --- a/src/utils/getRoles.ts +++ b/src/utils/getRoles.ts @@ -1,4 +1,4 @@ -import fetchWrapper from "./fetchWrapper.js"; +import fetchWrapper from "./fetchWrapper"; export default async function getRoles() { return fetchWrapper("/api/roles", null, "GET"); diff --git a/src/utils/getUser.ts b/src/utils/getUser.ts index 7a485b8..811c2b5 100644 --- a/src/utils/getUser.ts +++ b/src/utils/getUser.ts @@ -1,4 +1,4 @@ -import fetchWrapper from "./fetchWrapper.js"; +import fetchWrapper from "./fetchWrapper"; export default async function getUser() { return fetchWrapper("/api/users/me", null, "GET"); diff --git a/src/utils/getXSRF.ts b/src/utils/getXSRF.ts index f96606d..c7b8048 100644 --- a/src/utils/getXSRF.ts +++ b/src/utils/getXSRF.ts @@ -1,23 +1,3 @@ -/*export default async function getXSRFToken() { - const response = await fetch(`${import.meta.env.VITE_API_URL}/sanctum/csrf-cookie`, { - method: 'GET', - credentials: 'include' - }); - - if (!response.ok && response.status !== 204) { - throw new Error(`Error : ${response.status}`); - } - - const name = 'XSRF-TOKEN'; - const value = `; ${document.cookie}`; - const parts = value.split(`; ${name}=`); - if (parts.length === 2) { - return decodeURIComponent(parts.pop().split(';').shift()); - } - - throw new Error('Error: Invalid XSRF-TOKEN'); -}*/ - export default async function getXSRFToken(): Promise { const response = await fetch(`${import.meta.env.VITE_API_URL}/sanctum/csrf-cookie`, { method: 'GET', diff --git a/src/utils/notifications/deleteNotificationUser.js b/src/utils/notifications/deleteNotificationUser.js index b7d7a93..d01c8a3 100644 --- a/src/utils/notifications/deleteNotificationUser.js +++ b/src/utils/notifications/deleteNotificationUser.js @@ -1,4 +1,4 @@ -import getXSRFToken from "../getXSRF.js"; +import getXSRFToken from "../getXSRF"; export default async function deleteNotificationUser(notificationId) { const csrfToken = await getXSRFToken(); diff --git a/src/utils/notifications/readNotifications.js b/src/utils/notifications/readNotifications.js index 0f406ce..5b7f998 100644 --- a/src/utils/notifications/readNotifications.js +++ b/src/utils/notifications/readNotifications.js @@ -1,4 +1,4 @@ -import getXSRFToken from "../getXSRF.js"; +import getXSRFToken from "../getXSRF"; export default async function readNotifications() {