feat: add auth-state awareness and graceful degradation

- Add /api/auth/whoami endpoint check on app load
- Store auth state in Zustand (authenticated, username, loaded)
- Hide Contacts tab when unauthenticated
- Gate fetchNearbyContacts calls on auth.authenticated
- Replace Save button with Log in affordance when unauthenticated
- Add Login/Logout buttons to panel header
- Prevent any /api/contacts/* requests from firing when unauthenticated

Public functionality (search, routing, place details) remains
fully functional for unauthenticated users.
This commit is contained in:
Matt 2026-04-27 01:26:05 +00:00
commit 0d4a807a05
29 changed files with 13091 additions and 317 deletions

View file

@ -109,6 +109,10 @@ export const useStore = create((set, get) => ({
localStorage.removeItem('navi-theme-override')
}
},
// ── Auth state ──
auth: { authenticated: false, username: null, loaded: false },
setAuth: (auth) => set({ auth: { ...auth, loaded: true } }),
// ── Contacts ──
contacts: [],
contactsLoaded: false,