]> Untitled Git - lemmy-ui.git/commitdiff
Redirect fomr pages that require auth on logout
authorSleeplessOne1917 <abias1122@gmail.com>
Sat, 13 May 2023 14:38:43 +0000 (10:38 -0400)
committerSleeplessOne1917 <abias1122@gmail.com>
Sat, 13 May 2023 14:38:43 +0000 (10:38 -0400)
src/shared/services/UserService.ts

index e4ec5f987069a60aa37162dc7b53ac34bbc60a01..b5f8d26040ab6307a6fa3293a777cc0fd15fd68a 100644 (file)
@@ -48,7 +48,15 @@ export class UserService {
     this.myUserInfo = undefined;
     IsomorphicCookie.remove("jwt"); // TODO is sometimes unreliable for some reason
     document.cookie = "jwt=; Max-Age=0; path=/; domain=" + location.hostname;
-    location.reload();
+    if (
+      /create_.*|inbox|settings|setup|admin|reports|registration_applications/g.test(
+        location.pathname
+      )
+    ) {
+      location.replace("/");
+    } else {
+      location.reload();
+    }
   }
 
   public auth(throwErr = true): string | undefined {