diff --git a/frontend/src/components/header/notificationBell.js b/frontend/src/components/header/notificationBell.js index 0386f90c46..a75b1f9829 100644 --- a/frontend/src/components/header/notificationBell.js +++ b/frontend/src/components/header/notificationBell.js @@ -49,7 +49,7 @@ export const NotificationBell = () => { setBellPosition(e.target.getBoundingClientRect().left); setPopoutFocus(!isPopoutFocus); if (doesUnreadNotificationsExist) { - pushToLocalJSONAPI('/api/v2/notifications/queries/own/post-unread/', null, token); + pushToLocalJSONAPI('notifications/queries/own/post-unread/', null, token); setDoesUnreadNotificationsExist(false); } }; diff --git a/frontend/src/components/notifications/actionButtons.js b/frontend/src/components/notifications/actionButtons.js index d2f2c96f33..1816f6cdc0 100644 --- a/frontend/src/components/notifications/actionButtons.js +++ b/frontend/src/components/notifications/actionButtons.js @@ -34,13 +34,13 @@ export const ActionButtons = ({ const deleteMessages = () => { if (isAllSelected) { - pushToLocalJSONAPI(`/api/v2/notifications/delete-all/${param}`, null, token, 'DELETE') + pushToLocalJSONAPI(`notifications/delete-all/${param}`, null, token, 'DELETE') .then(() => handleSuccess()) .catch((e) => { console.log(e.message); }); } else { - pushToLocalJSONAPI(`/api/v2/notifications/delete-multiple/`, payload, token, 'DELETE') + pushToLocalJSONAPI(`notifications/delete-multiple/`, payload, token, 'DELETE') .then(() => { // Decrement the page query if the user deleted all notifications in the last page if (inboxQuery.page === totalPages && selected.length === pageOfCards.length) { @@ -64,13 +64,13 @@ export const ActionButtons = ({ const markNotificationsAsRead = () => { if (isAllSelected) { - pushToLocalJSONAPI(`/api/v2/notifications/mark-as-read-all/${param}`, null, token, 'POST') + pushToLocalJSONAPI(`notifications/mark-as-read-all/${param}`, null, token, 'POST') .then(() => handleSuccess()) .catch((e) => { console.log(e.message); }); } else { - pushToLocalJSONAPI(`/api/v2/notifications/mark-as-read-multiple/`, payload, token, 'POST') + pushToLocalJSONAPI(`notifications/mark-as-read-multiple/`, payload, token, 'POST') .then(() => handleSuccess()) .catch((e) => { console.log(e.message); diff --git a/frontend/src/network/genericJSONRequest.js b/frontend/src/network/genericJSONRequest.js index 6d2011d415..dfda46098e 100644 --- a/frontend/src/network/genericJSONRequest.js +++ b/frontend/src/network/genericJSONRequest.js @@ -25,6 +25,7 @@ export function fetchExternalJSONAPI(url, init = {}) { export function fetchLocalJSONAPI(endpoint, token, method = 'GET', language = 'en') { const url = new URL(endpoint, API_URL); + let headers = { 'Content-Type': 'application/json', 'Accept-Language': language.replace('-', '_'), @@ -68,13 +69,7 @@ export function fetchLocalJSONAPIWithAbort( }); } -export function pushToLocalJSONAPI( - endpoint, - payload, - token, - method = 'POST', - language = 'en', -) { +export function pushToLocalJSONAPI(endpoint, payload, token, method = 'POST', language = 'en') { const url = new URL(endpoint, API_URL); return fetch(url, { method: method, diff --git a/frontend/src/views/authorized.js b/frontend/src/views/authorized.js index 1b885fa949..37db021922 100644 --- a/frontend/src/views/authorized.js +++ b/frontend/src/views/authorized.js @@ -10,7 +10,7 @@ import { AnimatedLoadingIcon } from '../components/button'; export function Authorized(props) { const authComplete = (authCode, state) => { - let callback_url = `/api/v2/system/authentication/callback/?redirect_uri=${OSM_REDIRECT_URI}&code=${authCode}`; + let callback_url = `system/authentication/callback/?redirect_uri=${OSM_REDIRECT_URI}&code=${authCode}`; const emailAddress = getItem('email_address'); if (emailAddress !== null) { callback_url += `&email_address=${emailAddress}`; diff --git a/frontend/src/views/verifyEmail.js b/frontend/src/views/verifyEmail.js index bd892e9c8f..b2d25f8674 100644 --- a/frontend/src/views/verifyEmail.js +++ b/frontend/src/views/verifyEmail.js @@ -18,7 +18,7 @@ export function EmailVerification() { useEffect(() => { if (token && username) { - fetchLocalJSONAPI(`/api/v2/system/authentication/email/?token=${token}&username=${username}`) + fetchLocalJSONAPI(`system/authentication/email/?token=${token}&username=${username}`) .then((success) => setStatus('emailVerified')) .catch((error) => setStatus('verificationError')); }