feat: User onboarding finished

This commit is contained in:
Eric Gullickson
2025-12-23 10:26:10 -06:00
parent 55cf4923b8
commit 96ee43ea94
19 changed files with 698 additions and 67 deletions

View File

@@ -26,8 +26,12 @@ export const Auth0Provider: React.FC<Auth0ProviderProps> = ({ children }) => {
const onRedirectCallback = (appState?: { returnTo?: string }) => {
console.log('[Auth0Provider] Redirect callback triggered', { appState, returnTo: appState?.returnTo });
const target = appState?.returnTo || '/garage';
navigate(target, { replace: true });
// Route to callback page which will check user status and redirect appropriately
// Pass the intended destination as state for after status check
navigate('/callback', {
replace: true,
state: { returnTo: appState?.returnTo || '/garage' },
});
};
return (

View File

@@ -0,0 +1,25 @@
/**
* @ai-summary React Query hook for user status (email verification + onboarding)
* @ai-context Used by CallbackPage to determine routing after Auth0 callback
*/
import { useQuery } from '@tanstack/react-query';
import { useAuth0 } from '@auth0/auth0-react';
import { authApi } from '../../features/auth/api/auth.api';
import { UserStatusResponse } from '../../features/auth/types/auth.types';
interface UseUserStatusOptions {
enabled?: boolean;
}
export const useUserStatus = (options?: UseUserStatusOptions) => {
const { isAuthenticated, isLoading: isAuthLoading } = useAuth0();
return useQuery<UserStatusResponse>({
queryKey: ['userStatus'],
queryFn: authApi.getUserStatus,
enabled: (options?.enabled !== false) && isAuthenticated && !isAuthLoading,
retry: 2,
staleTime: 30000, // Cache for 30 seconds
});
};