mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-30 00:01:15 +00:00
Redirect fomr pages that require auth on logout
This commit is contained in:
parent
8c06eb9749
commit
f31cd42d8e
1 changed files with 9 additions and 1 deletions
|
@ -48,8 +48,16 @@ export class UserService {
|
||||||
this.myUserInfo = undefined;
|
this.myUserInfo = undefined;
|
||||||
IsomorphicCookie.remove("jwt"); // TODO is sometimes unreliable for some reason
|
IsomorphicCookie.remove("jwt"); // TODO is sometimes unreliable for some reason
|
||||||
document.cookie = "jwt=; Max-Age=0; path=/; domain=" + location.hostname;
|
document.cookie = "jwt=; Max-Age=0; path=/; domain=" + location.hostname;
|
||||||
|
if (
|
||||||
|
/create_.*|inbox|settings|setup|admin|reports|registration_applications/g.test(
|
||||||
|
location.pathname
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
location.replace("/");
|
||||||
|
} else {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public auth(throwErr = true): string | undefined {
|
public auth(throwErr = true): string | undefined {
|
||||||
let jwt = this.jwtInfo?.jwt;
|
let jwt = this.jwtInfo?.jwt;
|
||||||
|
|
Loading…
Reference in a new issue