mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 16:56:22 +02:00
feat: enhance login tracking and logout functionality
- Added session storage flag to track local login success, ensuring OAuth flows do not double track login events. - Implemented tracking for logout events in both UserDropdown and AppSidebar components, resetting PostHog identity accordingly. - Minor formatting adjustments in GoogleLoginButton and footer-new components for consistency.
This commit is contained in:
parent
458c152032
commit
d20aef2957
8 changed files with 84 additions and 4 deletions
|
|
@ -42,6 +42,7 @@ import {
|
|||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { resetUser, trackLogout } from "@/lib/posthog/events";
|
||||
|
||||
/**
|
||||
* Generates a consistent color based on a string (email)
|
||||
|
|
@ -343,6 +344,10 @@ export const AppSidebar = memo(function AppSidebar({
|
|||
|
||||
const handleLogout = () => {
|
||||
try {
|
||||
// Track logout event and reset PostHog identity
|
||||
trackLogout();
|
||||
resetUser();
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
localStorage.removeItem("surfsense_bearer_token");
|
||||
router.push("/");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue