✨ auto register guest account
This commit is contained in:
parent
dade6d30d2
commit
2c3fe9bd9e
@ -39,6 +39,16 @@
|
|||||||
// TODO: remote auth
|
// TODO: remote auth
|
||||||
// window.GLOBAL_ENV.REMOTE_AUTH_ENDPOINT = window.GLOBAL_ENV.GATEWAY_ENDPOINT.replace(/wss?:/, "");
|
// window.GLOBAL_ENV.REMOTE_AUTH_ENDPOINT = window.GLOBAL_ENV.GATEWAY_ENDPOINT.replace(/wss?:/, "");
|
||||||
localStorage.removeItem("gatewayURL");
|
localStorage.removeItem("gatewayURL");
|
||||||
|
const token = JSON.parse(localStorage.getItem("token"));
|
||||||
|
if (!token) {
|
||||||
|
fetch(`${window.GLOBAL_ENV.API_ENDPOINT}/auth/register`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "content-type": "application/json" },
|
||||||
|
body: JSON.stringify({ username: "Anonymous", consent: true })
|
||||||
|
})
|
||||||
|
.then((x) => x.json())
|
||||||
|
.then((x) => localStorage.setItem("token", `"${x.token}"`));
|
||||||
|
}
|
||||||
|
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
"DeveloperOptionsStore",
|
"DeveloperOptionsStore",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user