mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
Merge branch 'dev' into fix/remove-forcemount-from-user-dropdown
This commit is contained in:
commit
b82a4fb921
282 changed files with 20299 additions and 4969 deletions
|
|
@ -16,7 +16,7 @@ import {
|
|||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { logout } from "@/lib/auth-utils";
|
||||
import { getLoginPath, logout } from "@/lib/auth-utils";
|
||||
import { resetUser, trackLogout } from "@/lib/posthog/events";
|
||||
|
||||
export function UserDropdown({
|
||||
|
|
@ -35,21 +35,24 @@ export function UserDropdown({
|
|||
if (isLoggingOut) return;
|
||||
setIsLoggingOut(true);
|
||||
try {
|
||||
// Track logout event and reset PostHog identity
|
||||
trackLogout();
|
||||
resetUser();
|
||||
|
||||
// Revoke refresh token on server and clear all tokens from localStorage
|
||||
await logout();
|
||||
|
||||
router.push("/");
|
||||
router.refresh();
|
||||
if (typeof window !== "undefined") {
|
||||
window.location.href = getLoginPath();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error during logout:", error);
|
||||
// Even if there's an error, try to clear tokens and redirect
|
||||
await logout();
|
||||
router.push("/");
|
||||
router.refresh();
|
||||
if (typeof window !== "undefined") {
|
||||
window.location.href = getLoginPath();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue