feat: verify state

This commit is contained in:
2025-06-07 00:14:09 +02:00
parent 06c60b3491
commit cc49ab1655

34
web/src/store/verify.ts Normal file
View File

@ -0,0 +1,34 @@
import { create } from "zustand";
import { useAuth } from "./auth";
import type { UserProfile } from "@/types";
export type VerifyStep = "email" | "avatar" | "review";
export interface IVerifyState {
step: VerifyStep | null;
loadStep: (profile: UserProfile) => void;
}
export const useVerify = create<IVerifyState>((set) => ({
step: null,
loadStep: (profile) => {
if (!profile.email_verified) {
set({ step: "email" });
return;
}
if (!profile.avatar_verified) {
set({ step: "avatar" });
return;
}
if (!profile.verified) {
set({ step: "review" });
return;
}
set({ step: null });
},
}));