From ee8f58440b4e8fb0909f652e75bb35088a41bba4 Mon Sep 17 00:00:00 2001 From: HF Date: Sun, 4 Sep 2022 03:56:09 +0200 Subject: [PATCH] change api links --- src/store/actions/fetch.js | 34 +++++++++++++++++----------------- src/store/actions/thunks.js | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/store/actions/fetch.js b/src/store/actions/fetch.js index 44d60d3..923e54b 100644 --- a/src/store/actions/fetch.js +++ b/src/store/actions/fetch.js @@ -108,7 +108,7 @@ async function makeAPIGETRequest(url) { */ export async function requestBlock(userId, block) { const res = await makeAPIPOSTRequest( - 'api/block', + '/api/block', { userId, block }, ); if (res.errors) { @@ -127,7 +127,7 @@ export async function requestBlock(userId, block) { */ export async function requestStartDm(query) { const res = await makeAPIPOSTRequest( - 'api/startdm', + '/api/startdm', query, ); if (res.errors) { @@ -146,7 +146,7 @@ export async function requestStartDm(query) { */ export async function requestBlockDm(block) { const res = await makeAPIPOSTRequest( - 'api/blockdm', + '/api/blockdm', { block }, ); if (res.errors) { @@ -165,7 +165,7 @@ export async function requestBlockDm(block) { */ export async function requestLeaveChan(channelId) { const res = await makeAPIPOSTRequest( - 'api/leavechan', + '/api/leavechan', { channelId }, ); if (res.errors) { @@ -179,7 +179,7 @@ export async function requestLeaveChan(channelId) { export async function requestSolveCaptcha(text, captchaid) { const res = await makeAPIPOSTRequest( - 'api/captcha', + '/api/captcha', { text, id: captchaid }, ); if (!res.errors && !res.success) { @@ -214,48 +214,48 @@ export async function requestHistoricalTimes(day, canvasId) { export function requestPasswordChange(newPassword, password) { return makeAPIPOSTRequest( - 'api/auth/change_passwd', + '/api/auth/change_passwd', { password, newPassword }, ); } export async function requestResendVerify() { return makeAPIGETRequest( - 'api/auth/resend_verify', + '/api/auth/resend_verify', ); } export async function requestLogOut() { const ret = makeAPIGETRequest( - 'api/auth/logout', + '/api/auth/logout', ); return !ret.errors; } export function requestNameChange(name) { return makeAPIPOSTRequest( - 'api/auth/change_name', + '/api/auth/change_name', { name }, ); } export function requestMailChange(email, password) { return makeAPIPOSTRequest( - 'api/auth/change_mail', + '/api/auth/change_mail', { email, password }, ); } export function requestLogin(nameoremail, password) { return makeAPIPOSTRequest( - 'api/auth/local', + '/api/auth/local', { nameoremail, password }, ); } export function requestRegistration(name, email, password, captcha, captchaid) { return makeAPIPOSTRequest( - 'api/auth/register', + '/api/auth/register', { name, email, password, captcha, captchaid, }, @@ -264,14 +264,14 @@ export function requestRegistration(name, email, password, captcha, captchaid) { export function requestNewPassword(email) { return makeAPIPOSTRequest( - 'api/auth/restore_password', + '/api/auth/restore_password', { email }, ); } export function requestDeleteAccount(password) { return makeAPIPOSTRequest( - 'api/auth/delete_account', + '/api/auth/delete_account', { password }, ); } @@ -284,18 +284,18 @@ export function requestRankings() { export function requestBanInfo() { return makeAPIGETRequest( - 'api/baninfo', + '/api/baninfo', ); } export function requestMe() { return makeAPIGETRequest( - 'api/me', + '/api/me', ); } export function requestIID() { return makeAPIGETRequest( - 'api/getiid', + '/api/getiid', ); } diff --git a/src/store/actions/thunks.js b/src/store/actions/thunks.js index 1bcd317..83a437c 100644 --- a/src/store/actions/thunks.js +++ b/src/store/actions/thunks.js @@ -94,7 +94,7 @@ export function fetchChatMessages( ) { return async (dispatch) => { dispatch(setChatFetching(true)); - const response = await fetch(`api/chathistory?cid=${cid}&limit=50`, { + const response = await fetch(`/api/chathistory?cid=${cid}&limit=50`, { credentials: 'include', });