fix: use useAuthStore instead of useAuth in profile page

This commit is contained in:
2026-04-01 09:18:35 +00:00
parent 7a89c9d75b
commit 35018e4b88

View File

@@ -2,7 +2,7 @@
import { useState } from "react"; import { useState } from "react";
import { useMutation } from "@tanstack/react-query"; import { useMutation } from "@tanstack/react-query";
import { useAuth } from "@/contexts/AuthContext"; import { useAuthStore } from "@/lib/auth-store";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/Card"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/Card";
import { Button } from "@/components/ui/Button"; import { Button } from "@/components/ui/Button";
import { Input } from "@/components/ui/Input"; import { Input } from "@/components/ui/Input";
@@ -11,7 +11,7 @@ import api from "@/lib/api";
import { toast } from "sonner"; import { toast } from "sonner";
export default function ProfilePage() { export default function ProfilePage() {
const { user } = useAuth(); const user = useAuthStore((s) => s.user);
const [infoForm, setInfoForm] = useState({ const [infoForm, setInfoForm] = useState({
firstName: (user as any)?.firstName ?? user?.name?.split(" ")[0] ?? "", firstName: (user as any)?.firstName ?? user?.name?.split(" ")[0] ?? "",