feat(FN-005): implement frontend foundation with auth and routing
- Add OIDC authentication with PKCE flow - Create dashboard shell with sidebar and header - Implement project management UI (list, create, detail) - Add tool spawn page with tool/project selection - Create tool instance detail page with status and controls - Set up React Router with route guards - Add Zustand auth store and API client with types
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { create } from 'zustand'
|
||||
import type { User } from '../types/api.ts'
|
||||
|
||||
export type AuthState = 'loading' | 'authenticated' | 'unauthenticated' | 'error'
|
||||
|
||||
interface AuthStore {
|
||||
state: AuthState
|
||||
user: User | null
|
||||
error: Error | null
|
||||
setState: (state: AuthState) => void
|
||||
setUser: (user: User | null) => void
|
||||
setError: (error: Error | null) => void
|
||||
logout: () => void
|
||||
}
|
||||
|
||||
export const useAuthStore = create<AuthStore>((set) => ({
|
||||
state: 'loading',
|
||||
user: null,
|
||||
error: null,
|
||||
setState: (state) => set({ state }),
|
||||
setUser: (user) => set({ user, state: user ? 'authenticated' : 'unauthenticated' }),
|
||||
setError: (error) => set({ error, state: 'error' }),
|
||||
logout: () => set({ user: null, state: 'unauthenticated', error: null }),
|
||||
}))
|
||||
Reference in New Issue
Block a user