mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-13 17:20:14 +00:00
fix(dashboard): only clear token from localStorage on 401 error
This commit is contained in:
parent
66883cef51
commit
f731f0d453
2 changed files with 9 additions and 6 deletions
|
|
@ -58,9 +58,9 @@
|
||||||
user = res;
|
user = res;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
localStorage.removeItem("pk-token");
|
// localStorage.removeItem("pk-token");
|
||||||
localStorage.removeItem("pk-user");
|
// localStorage.removeItem("pk-user");
|
||||||
currentUser.update(() => null);
|
// currentUser.update(() => null);
|
||||||
navigate("/");
|
navigate("/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,12 @@
|
||||||
currentUser.update(() => res);
|
currentUser.update(() => res);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
localStorage.removeItem("pk-token");
|
if (error.code == 401) {
|
||||||
localStorage.removeItem("pk-user");
|
error.message = "Invalid token";
|
||||||
currentUser.update(() => null);
|
localStorage.removeItem("pk-token");
|
||||||
|
localStorage.removeItem("pk-user");
|
||||||
|
currentUser.update(() => null);
|
||||||
|
}
|
||||||
err = error.message;
|
err = error.message;
|
||||||
}
|
}
|
||||||
loading = false;
|
loading = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue