Remove deprecated authStore and update implementation plan progress tracking
- Deleted `authStore` in favor of updated state management and authentication handling. - Updated `IMPLEMENTATION_PLAN.md` with revised checklist and Phase 2 completion details.
This commit is contained in:
@@ -394,6 +394,7 @@ Phase 2 successfully built a working authentication UI layer on top of Phase 1's
|
|||||||
**Quality Metrics:**
|
**Quality Metrics:**
|
||||||
- Tests: 109/109 passing (100%)
|
- Tests: 109/109 passing (100%)
|
||||||
- TypeScript: 0 errors
|
- TypeScript: 0 errors
|
||||||
|
- ESLint: 0 errors in reviewed code (21 errors in auto-generated files, excluded)
|
||||||
- Coverage: 63.54% statements, 81.09% branches (below 70% threshold)
|
- Coverage: 63.54% statements, 81.09% branches (below 70% threshold)
|
||||||
- Core Components: Tested (AuthGuard 100%, useAuth convenience hooks, forms UI)
|
- Core Components: Tested (AuthGuard 100%, useAuth convenience hooks, forms UI)
|
||||||
- Coding Standards: Met (type guards instead of assertions)
|
- Coding Standards: Met (type guards instead of assertions)
|
||||||
@@ -589,22 +590,22 @@ Forms created:
|
|||||||
### Phase 2 Review Checklist
|
### Phase 2 Review Checklist
|
||||||
|
|
||||||
When Phase 2 is complete, verify:
|
When Phase 2 is complete, verify:
|
||||||
- [ ] All auth pages functional
|
- [x] All auth pages functional
|
||||||
- [ ] Forms have proper validation
|
- [x] Forms have proper validation
|
||||||
- [ ] Error messages are user-friendly
|
- [x] Error messages are user-friendly
|
||||||
- [ ] Loading states on all async operations
|
- [x] Loading states on all async operations
|
||||||
- [ ] E2E tests for full auth flows pass
|
- [ ] E2E tests for full auth flows pass (Deferred to Phase 9)
|
||||||
- [ ] Security audit completed
|
- [x] Security audit completed (0 vulnerabilities found)
|
||||||
- [ ] Accessibility audit completed
|
- [x] Accessibility audit completed (minor improvements documented)
|
||||||
- [ ] No console errors
|
- [x] No console errors (runtime clean, development has console.log statements)
|
||||||
- [ ] Works in mobile viewport
|
- [ ] Works in mobile viewport (Requires manual testing with running app)
|
||||||
- [ ] Dark mode works on all pages
|
- [ ] Dark mode works on all pages (Requires manual testing with running app)
|
||||||
|
|
||||||
**Before proceeding to Phase 3:**
|
**Before proceeding to Phase 3:**
|
||||||
- [ ] Run multi-agent review
|
- [x] Run multi-agent review (4 agents: code quality, testing, architecture, documentation)
|
||||||
- [ ] Security audit of auth implementation
|
- [x] Security audit of auth implementation (0 critical/major issues)
|
||||||
- [ ] E2E test full auth flows
|
- [ ] E2E test full auth flows (Deferred to Phase 9 - Playwright)
|
||||||
- [ ] Update this plan with actual progress
|
- [x] Update this plan with actual progress (COMPLETE)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
import { create } from 'zustand';
|
|
||||||
import { persist } from 'zustand/middleware';
|
|
||||||
|
|
||||||
// User type - will be replaced with generated types later
|
|
||||||
interface User {
|
|
||||||
id: string;
|
|
||||||
email: string;
|
|
||||||
full_name?: string;
|
|
||||||
is_active: boolean;
|
|
||||||
is_superuser: boolean;
|
|
||||||
organization_id?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AuthState {
|
|
||||||
// State
|
|
||||||
user: User | null;
|
|
||||||
accessToken: string | null;
|
|
||||||
refreshToken: string | null;
|
|
||||||
isAuthenticated: boolean;
|
|
||||||
|
|
||||||
// Actions
|
|
||||||
setUser: (user: User) => void;
|
|
||||||
setTokens: (accessToken: string, refreshToken: string) => void;
|
|
||||||
setAuth: (user: User, accessToken: string, refreshToken: string) => void;
|
|
||||||
clearAuth: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useAuthStore = create<AuthState>()(
|
|
||||||
persist(
|
|
||||||
(set) => ({
|
|
||||||
// Initial state
|
|
||||||
user: null,
|
|
||||||
accessToken: null,
|
|
||||||
refreshToken: null,
|
|
||||||
isAuthenticated: false,
|
|
||||||
|
|
||||||
// Actions
|
|
||||||
setUser: (user) =>
|
|
||||||
set({
|
|
||||||
user,
|
|
||||||
isAuthenticated: true,
|
|
||||||
}),
|
|
||||||
|
|
||||||
setTokens: (accessToken, refreshToken) =>
|
|
||||||
set({
|
|
||||||
accessToken,
|
|
||||||
refreshToken,
|
|
||||||
}),
|
|
||||||
|
|
||||||
setAuth: (user, accessToken, refreshToken) =>
|
|
||||||
set({
|
|
||||||
user,
|
|
||||||
accessToken,
|
|
||||||
refreshToken,
|
|
||||||
isAuthenticated: true,
|
|
||||||
}),
|
|
||||||
|
|
||||||
clearAuth: () =>
|
|
||||||
set({
|
|
||||||
user: null,
|
|
||||||
accessToken: null,
|
|
||||||
refreshToken: null,
|
|
||||||
isAuthenticated: false,
|
|
||||||
}),
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
name: 'auth-storage', // localStorage key
|
|
||||||
partialize: (state) => ({
|
|
||||||
// Only persist these fields
|
|
||||||
user: state.user,
|
|
||||||
accessToken: state.accessToken,
|
|
||||||
refreshToken: state.refreshToken,
|
|
||||||
isAuthenticated: state.isAuthenticated,
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
Reference in New Issue
Block a user