refactor: Update API endpoint paths from "_allauth" to "auth" for consistency
This commit is contained in:
@@ -31,7 +31,7 @@ export const load: PageServerLoad = async (event) => {
|
||||
});
|
||||
let user = (await res.json()) as User;
|
||||
|
||||
let emailFetch = await fetch(`${endpoint}/_allauth/browser/v1/account/email`, {
|
||||
let emailFetch = await fetch(`${endpoint}/auth/browser/v1/account/email`, {
|
||||
headers: {
|
||||
Cookie: `sessionid=${sessionId}`
|
||||
}
|
||||
@@ -45,14 +45,11 @@ export const load: PageServerLoad = async (event) => {
|
||||
return redirect(302, '/');
|
||||
}
|
||||
|
||||
let mfaAuthenticatorFetch = await fetch(
|
||||
`${endpoint}/_allauth/browser/v1/account/authenticators`,
|
||||
{
|
||||
headers: {
|
||||
Cookie: `sessionid=${sessionId}`
|
||||
}
|
||||
let mfaAuthenticatorFetch = await fetch(`${endpoint}/auth/browser/v1/account/authenticators`, {
|
||||
headers: {
|
||||
Cookie: `sessionid=${sessionId}`
|
||||
}
|
||||
);
|
||||
});
|
||||
let mfaAuthenticatorResponse = (await mfaAuthenticatorFetch.json()) as MFAAuthenticatorResponse;
|
||||
let authenticators = (mfaAuthenticatorResponse.data.length > 0) as boolean;
|
||||
|
||||
@@ -208,7 +205,7 @@ export const actions: Actions = {
|
||||
let csrfToken = await fetchCSRFToken();
|
||||
|
||||
if (current_password) {
|
||||
let res = await fetch(`${endpoint}/_allauth/browser/v1/account/password/change`, {
|
||||
let res = await fetch(`${endpoint}/auth/browser/v1/account/password/change`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Referer: event.url.origin, // Include Referer header
|
||||
@@ -226,7 +223,7 @@ export const actions: Actions = {
|
||||
}
|
||||
return { success: true };
|
||||
} else {
|
||||
let res = await fetch(`${endpoint}/_allauth/browser/v1/account/password/change`, {
|
||||
let res = await fetch(`${endpoint}/auth/browser/v1/account/password/change`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Referer: event.url.origin, // Include Referer header
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
}
|
||||
|
||||
async function removeEmail(email: { email: any; verified?: boolean; primary?: boolean }) {
|
||||
let res = await fetch('/_allauth/browser/v1/account/email/', {
|
||||
let res = await fetch('/auth/browser/v1/account/email', {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
@@ -88,7 +88,7 @@
|
||||
}
|
||||
|
||||
async function verifyEmail(email: { email: any; verified?: boolean; primary?: boolean }) {
|
||||
let res = await fetch('/_allauth/browser/v1/account/email/', {
|
||||
let res = await fetch('/auth/browser/v1/account/email/', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
@@ -103,7 +103,7 @@
|
||||
}
|
||||
|
||||
async function addEmail() {
|
||||
let res = await fetch('/_allauth/browser/v1/account/email/', {
|
||||
let res = await fetch('/auth/browser/v1/account/email/', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
@@ -122,7 +122,7 @@
|
||||
}
|
||||
|
||||
async function primaryEmail(email: { email: any; verified?: boolean; primary?: boolean }) {
|
||||
let res = await fetch('/_allauth/browser/v1/account/email/', {
|
||||
let res = await fetch('/auth/browser/v1/account/email/', {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
@@ -194,7 +194,7 @@
|
||||
}
|
||||
|
||||
async function disableMfa() {
|
||||
const res = await fetch('/_allauth/browser/v1/account/authenticators/totp', {
|
||||
const res = await fetch('/auth/browser/v1/account/authenticators/totp', {
|
||||
method: 'DELETE'
|
||||
});
|
||||
if (res.ok) {
|
||||
|
||||
Reference in New Issue
Block a user