This commit is contained in:
ct
2025-07-15 03:27:39 +08:00
parent eb207b98d9
commit 852346ee3b
13 changed files with 44 additions and 61 deletions

View File

@@ -1,6 +1,6 @@
import { type BreadcrumbItem, type SharedData } from '@/types';
import { type BreadcrumbItem } from '@/types';
import { Transition } from '@headlessui/react';
import { Head, Link, useForm, usePage } from '@inertiajs/react';
import { Head, Link, useForm } from '@inertiajs/react';
import { FormEventHandler } from 'react';
import DeleteUser from '@/components/delete-user';
@@ -11,6 +11,7 @@ import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import AppLayout from '@/layouts/app-layout';
import SettingsLayout from '@/layouts/settings/layout';
import useUserStore from '@/stores/UserStore';
const breadcrumbs: BreadcrumbItem[] = [
{
@@ -25,11 +26,11 @@ type ProfileForm = {
}
export default function Profile({ mustVerifyEmail, status }: { mustVerifyEmail: boolean; status?: string }) {
const { auth } = usePage<SharedData>().props;
const { user } = useUserStore();
const { data, setData, patch, errors, processing, recentlySuccessful } = useForm<Required<ProfileForm>>({
name: auth.user.name,
email: auth.user.email,
name: user?.name || '',
email: user?.email || '',
});
const submit: FormEventHandler = (e) => {
@@ -82,7 +83,7 @@ export default function Profile({ mustVerifyEmail, status }: { mustVerifyEmail:
<InputError className="mt-2" message={errors.email} />
</div>
{mustVerifyEmail && auth.user.email_verified_at === null && (
{mustVerifyEmail && user?.email_verified_at === null && (
<div>
<p className="text-muted-foreground -mt-4 text-sm">
Your email address is unverified.{' '}