The recipes.blue monorepo recipes.blue
recipes appview atproto
2
fork

Configure Feed

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

fix: improve logout ux

+12 -3
+2 -2
apps/web/src/components/nav-user.tsx
··· 27 27 28 28 export function NavUser() { 29 29 const { isMobile } = useSidebar() 30 - const { isLoggedIn, agent } = useAuth(); 30 + const { isLoggedIn, agent, logOut } = useAuth(); 31 31 32 32 const userQuery = useUserQuery(); 33 33 ··· 101 101 </div> 102 102 </DropdownMenuLabel> 103 103 <DropdownMenuSeparator /> 104 - <DropdownMenuItem className="cursor-pointer" onClick={() => agent.signOut()}> 104 + <DropdownMenuItem className="cursor-pointer" onClick={() => logOut()}> 105 105 <LogOut /> 106 106 Log out 107 107 </DropdownMenuItem>
+10 -1
apps/web/src/state/auth.tsx
··· 5 5 type AuthContextType = { 6 6 isLoggedIn: boolean; 7 7 agent?: OAuthUserAgent; 8 + logOut: () => Promise<void>; 8 9 }; 9 10 10 11 const AuthContext = createContext<AuthContextType>({ 11 12 isLoggedIn: false, 13 + logOut: async () => {}, 12 14 }); 13 15 14 16 export const AuthProvider = ({ children }: PropsWithChildren) => { ··· 57 59 if (!isReady) return null; 58 60 59 61 return ( 60 - <AuthContext.Provider value={{ isLoggedIn, agent }}> 62 + <AuthContext.Provider value={{ 63 + isLoggedIn, 64 + agent, 65 + logOut: async () => { 66 + setIsLoggedIn(false); 67 + await agent?.signOut(); 68 + }, 69 + }}> 61 70 {children} 62 71 </AuthContext.Provider> 63 72 );