feat: self-serve signup Phase 2 (frontend cutover) (#162)
Co-authored-by: Michael Chihlas <michael@resolutionflow.com> Co-committed-by: Michael Chihlas <michael@resolutionflow.com>
This commit was merged in pull request #162.
This commit is contained in:
27
frontend/src/hooks/useOnboardingStatus.ts
Normal file
27
frontend/src/hooks/useOnboardingStatus.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { getOnboardingStatus } from '@/api/onboarding'
|
||||
import type { OnboardingStatus } from '@/api/onboarding'
|
||||
|
||||
/**
|
||||
* Tiny shared hook that fetches `/users/onboarding-status` once on mount.
|
||||
*
|
||||
* Used by `NextStepCard`, `SetupChecklist`, and `QuickStartPage` so the toggle
|
||||
* row can disappear when there's nothing to show. Each consumer has its own
|
||||
* state — fetches are not deduplicated. That's fine for now; if it becomes a
|
||||
* problem we can lift this into a Zustand store or react-query.
|
||||
*/
|
||||
export function useOnboardingStatus(): OnboardingStatus | null {
|
||||
const [status, setStatus] = useState<OnboardingStatus | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
getOnboardingStatus()
|
||||
.then(setStatus)
|
||||
.catch(() => {
|
||||
// Silently fail — never block the dashboard if the endpoint is down.
|
||||
})
|
||||
}, [])
|
||||
|
||||
return status
|
||||
}
|
||||
|
||||
export default useOnboardingStatus
|
||||
Reference in New Issue
Block a user