fix: improve auth store with user state and role validation

This commit is contained in:
zetaloop
2026-02-20 20:40:25 +08:00
parent 9267df9ea1
commit 6008aa9b04
4 changed files with 38 additions and 17 deletions
+2 -1
View File
@@ -9,6 +9,7 @@ import { z } from "zod"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { currentUser } from "@/lib/mock-data"
import { useAuthStore } from "@/store/auth"
const registerSchema = z
@@ -36,7 +37,7 @@ export default function RegisterPage() {
const onSubmit = async (_data: z.infer<typeof registerSchema>) => {
await new Promise((r) => setTimeout(r, 500))
login()
login(currentUser, ["consumer"])
router.push("/")
}