Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/components/header/notificationBell.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/notifications/actionButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
9 changes: 2 additions & 7 deletions frontend/src/network/genericJSONRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('-', '_'),
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/authorized.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/verifyEmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
Expand Down
Loading