mirror of
https://github.com/unraid/api.git
synced 2025-12-31 21:49:57 -06:00
fix: thorw on invalid token body
This commit is contained in:
@@ -30,7 +30,6 @@ const getInputFields = (): {
|
|||||||
|
|
||||||
const enterCallbackTokenIntoField = (token: string) => {
|
const enterCallbackTokenIntoField = (token: string) => {
|
||||||
const { form, passwordField, usernameField } = getInputFields();
|
const { form, passwordField, usernameField } = getInputFields();
|
||||||
console.trace(passwordField, usernameField, form);
|
|
||||||
if (!passwordField || !usernameField || !form) {
|
if (!passwordField || !usernameField || !form) {
|
||||||
console.warn('Could not find form, username, or password field');
|
console.warn('Could not find form, username, or password field');
|
||||||
} else {
|
} else {
|
||||||
@@ -87,6 +86,9 @@ onMounted(async () => {
|
|||||||
});
|
});
|
||||||
if (token.ok) {
|
if (token.ok) {
|
||||||
const tokenBody = await token.json();
|
const tokenBody = await token.json();
|
||||||
|
if (!tokenBody.access_token) {
|
||||||
|
throw new Error('Token body did not contain access_token');
|
||||||
|
}
|
||||||
enterCallbackTokenIntoField(tokenBody.access_token);
|
enterCallbackTokenIntoField(tokenBody.access_token);
|
||||||
if (window.location.search) {
|
if (window.location.search) {
|
||||||
window.history.replaceState({}, document.title, window.location.pathname);
|
window.history.replaceState({}, document.title, window.location.pathname);
|
||||||
|
|||||||
Reference in New Issue
Block a user