Files
t3code/apps/web/src/onboarding/firstRun.ts
T

17 lines
633 B
TypeScript

import { useCallback } from "react";
import { ensureClientSettingsHydrated, persistClientSettingsUpdate } from "../hooks/useSettings";
/**
* Marks first-run onboarding finished (or skipped) so FirstRunGate never
* routes to the welcome wizard again. The gate itself lives in
* `components/onboarding/FirstRunGate.tsx`.
*/
export function useCompleteOnboarding(): () => Promise<void> {
return useCallback(async () => {
await ensureClientSettingsHydrated();
const onboardingCompletedAt = new Date().toISOString();
await persistClientSettingsUpdate((current) => ({ ...current, onboardingCompletedAt }));
}, []);
}