add optional prefix to url
This commit is contained in:
@@ -96,7 +96,7 @@
|
||||
if (emailForm) emailForm.addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
try {
|
||||
const res = await fetch('/editor/profile/email', {
|
||||
const res = await fetch(window.prefix('/editor/profile/email'), {
|
||||
method: 'POST',
|
||||
headers: Object.assign({'X-CSRF-Token': getCSRF()}),
|
||||
body: formToJSON(emailForm)
|
||||
@@ -121,7 +121,7 @@
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await fetch('/editor/profile/password', {
|
||||
const res = await fetch(window.prefix('/editor/profile/password'), {
|
||||
method: 'POST',
|
||||
headers: Object.assign({'X-CSRF-Token': getCSRF()}),
|
||||
body: formToJSON(passwordForm)
|
||||
@@ -141,7 +141,7 @@
|
||||
async function toggleMFA(enable) {
|
||||
try {
|
||||
const url = enable ? '/editor/profile/mfa/enable' : '/editor/profile/mfa/disable';
|
||||
const res = await fetch(url, { method: 'POST', headers: {'X-CSRF-Token': getCSRF()} });
|
||||
const res = await fetch(window.prefix(url), { method: 'POST', headers: {'X-CSRF-Token': getCSRF()} });
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (res.ok && data.success) {
|
||||
if (enable) {
|
||||
|
||||
Reference in New Issue
Block a user