mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-25 02:31:13 -05:00
Implement API improvements Phases 1-4
This commit is contained in:
@@ -306,6 +306,41 @@ When migrating a component:
|
||||
- Features: Automatic caching, refetch on window focus, 5-minute stale time
|
||||
- Returns: Array of blocked users with profile information
|
||||
|
||||
### Security
|
||||
- **`useEmailChangeStatus`** - Query email change verification status
|
||||
- Queries: `get_email_change_status` RPC function
|
||||
- Features: Automatic polling every 30 seconds, 15-second stale time
|
||||
- Returns: Email change status with verification flags
|
||||
|
||||
- **`useSessions`** - Fetch active user sessions
|
||||
- Queries: `get_my_sessions` RPC function
|
||||
- Features: Automatic caching, refetch on window focus, 5-minute stale time
|
||||
- Returns: Array of active sessions with device info
|
||||
|
||||
---
|
||||
|
||||
## Type Safety Guidelines
|
||||
|
||||
Always use proper TypeScript types in hooks:
|
||||
|
||||
```typescript
|
||||
// ✅ CORRECT - Define proper interfaces
|
||||
interface Profile {
|
||||
display_name?: string;
|
||||
bio?: string;
|
||||
}
|
||||
|
||||
queryClient.setQueryData<Profile>(['profile', userId], (old) =>
|
||||
old ? { ...old, ...updates } : old
|
||||
);
|
||||
|
||||
// ❌ WRONG - Using any type
|
||||
queryClient.setQueryData(['profile', userId], (old: any) => ({
|
||||
...old,
|
||||
...updates
|
||||
}));
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Cache Invalidation Guidelines
|
||||
|
||||
Reference in New Issue
Block a user