(READ ONLY) Margin is an open annotation layer for the internet. Powered by the AT Protocol. margin.at
extension web atproto comments
98
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 25 lines 618 B view raw
1import { atom } from "nanostores"; 2import { loadPreferences } from "./preferences"; 3import type { UserProfile } from "../types"; 4import { analytics } from "../lib/analytics"; 5 6export const $user = atom<UserProfile | null>(null); 7 8$user.subscribe((user) => { 9 if (user) { 10 loadPreferences(); 11 analytics.identify(user.did, { 12 handle: user.handle, 13 displayName: user.displayName, 14 }); 15 } 16}); 17 18export function logout() { 19 analytics.capture("user_logged_out"); 20 analytics.reset(); 21 $user.set(null); 22 fetch("/auth/logout", { method: "POST" }).finally(() => { 23 window.location.href = "/"; 24 }); 25}