fix: fix first time users logged in by mistake

This commit is contained in:
Damillora 2021-05-21 18:34:15 +07:00
parent 064f61cc89
commit ee2b7a50c3

View File

@ -1,8 +1,10 @@
import { writable } from "svelte/store"; import { writable } from "svelte/store";
const storedToken = localStorage.getItem("apiToken"); const storedToken = localStorage.getItem("apiToken") ?? "";
export const token = writable(storedToken); export const token = writable(storedToken);
token.subscribe(value => { token.subscribe(value => {
localStorage.setItem("apiToken", value); if (value != null) {
localStorage.setItem("apiToken", value);
}
}); });