Token in localStorage must be JSON

This commit is contained in:
Madeline 2022-06-27 16:04:17 +10:00
parent 6ead04def1
commit 3ac4953a0b

View File

@ -127,7 +127,7 @@
let token = getCookieValue("oauth-discord"); let token = getCookieValue("oauth-discord");
if (token.trim().length) { if (token.trim().length) {
document.cookie = "oauth-discord="; // don't care document.cookie = "oauth-discord="; // don't care
window.localStorage.setItem("token", token); window.localStorage.setItem("token", `"${token}"`);
window.location.href = "/app"; window.location.href = "/app";
} }
@ -152,7 +152,7 @@
const json = await response.json(); const json = await response.json();
if (json.token) { if (json.token) {
window.localStorage.setItem("token", json.token); window.localStorage.setItem("token", `"${json.token}"`);
window.location.href = "/app"; window.location.href = "/app";
} }
}) })