big thanks to @mallugamer4k for reporting and debugging this admin login issue!

This commit is contained in:
Roland Osborne 2023-10-08 21:58:10 -07:00
parent 50c1e07431
commit 97ec0067fc
9 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,7 @@
import { checkResponse, fetchWithTimeout } from './fetchUtil';
export async function addAccountAccess(token, accountId) {
let access = await fetchWithTimeout(`/admin/accounts/${accountId}/auth?token=${token}`, { method: 'POST' })
let access = await fetchWithTimeout(`/admin/accounts/${accountId}/auth?token=${encodeURIComponent(token)}`, { method: 'POST' })
checkResponse(access);
return await access.json()
}

View File

@ -1,7 +1,7 @@
import { checkResponse, fetchWithTimeout } from './fetchUtil';
export async function addAccountCreate(token) {
let access = await fetchWithTimeout(`/admin/accounts?token=${token}`, { method: 'POST' })
let access = await fetchWithTimeout(`/admin/accounts?token=${encodeURIComponent(token)}`, { method: 'POST' })
checkResponse(access);
return await access.json()
}

View File

@ -1,4 +1,4 @@
export function getAccountImageUrl(token, accountId) {
return `/admin/accounts/${accountId}/image?token=${token}`
return `/admin/accounts/${accountId}/image?token=${encodeURIComponent(token)}`
}

View File

@ -1,7 +1,7 @@
import { checkResponse, fetchWithTimeout } from './fetchUtil';
export async function getNodeAccounts(token) {
let accounts = await fetchWithTimeout(`/admin/accounts?token=${token}`, { method: 'GET' });
let accounts = await fetchWithTimeout(`/admin/accounts?token=${encodeURIComponent(token)}`, { method: 'GET' });
checkResponse(accounts);
return await accounts.json();
}

View File

@ -1,7 +1,7 @@
import { checkResponse, fetchWithTimeout } from './fetchUtil';
export async function getNodeConfig(token) {
let config = await fetchWithTimeout(`/admin/config?token=${token}`, { method: 'GET' });
let config = await fetchWithTimeout(`/admin/config?token=${encodeURIComponent(token)}`, { method: 'GET' });
checkResponse(config);
return await config.json();
}

View File

@ -1,7 +1,7 @@
import { checkResponse, fetchWithTimeout } from './fetchUtil';
export async function removeAccount(token, accountId) {
let res = await fetchWithTimeout(`/admin/accounts/${accountId}?token=${token}`, { method: 'DELETE' })
let res = await fetchWithTimeout(`/admin/accounts/${accountId}?token=${encodeURIComponent(token)}`, { method: 'DELETE' })
checkResponse(res);
}

View File

@ -1,7 +1,7 @@
import { checkResponse, fetchWithTimeout } from './fetchUtil';
export async function setAccountStatus(token, accountId, disabled) {
let res = await fetchWithTimeout(`/admin/accounts/${accountId}/status?token=${token}`, { method: 'PUT', body: JSON.stringify(disabled) })
let res = await fetchWithTimeout(`/admin/accounts/${accountId}/status?token=${encodeURIComponent(token)}`, { method: 'PUT', body: JSON.stringify(disabled) })
checkResponse(res);
}

View File

@ -2,7 +2,7 @@ import { checkResponse, fetchWithTimeout } from './fetchUtil';
export async function setNodeConfig(token, config) {
let body = JSON.stringify(config);
let settings = await fetchWithTimeout(`/admin/config?setOpenAccess=true&token=${token}`, { method: 'PUT', body });
let settings = await fetchWithTimeout(`/admin/config?setOpenAccess=true&token=${encodeURIComponent(token)}`, { method: 'PUT', body });
checkResponse(settings);
}

View File

@ -1,7 +1,7 @@
import { checkResponse, fetchWithTimeout } from './fetchUtil';
export async function setNodeStatus(token) {
let status = await fetchWithTimeout(`/admin/status?token=${token}`, { method: 'PUT' });
let status = await fetchWithTimeout(`/admin/status?token=${encodeURIComponent(token)}`, { method: 'PUT' });
checkResponse(status);
}