Skip to content

Commit a76bafa

Browse files
committed
Add email_verified_at field to User interface and update profile form to handle optional user properties
1 parent 36eec30 commit a76bafa

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

resources/js/pages/auth/verify-email.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default function VerifyEmail({ status }: Readonly<{ status?: string }>) {
3636
Resend verification email
3737
</Button>
3838

39-
<TextLink href={route('logout')} method="post" className="mx-auto block text-sm">
39+
<TextLink href={route('logout')} className="mx-auto block text-sm">
4040
Log out
4141
</TextLink>
4242
</form>

resources/js/pages/settings/profile.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export default function Profile({
3838
const { data, setData, patch, errors, processing, recentlySuccessful } = useForm<
3939
Required<ProfileForm>
4040
>({
41-
name: auth.user.name,
42-
email: auth.user.email,
41+
name: auth.user?.name ?? '',
42+
email: auth.user?.email ?? '',
4343
});
4444

4545
const submit: FormEventHandler = (e) => {
@@ -95,7 +95,7 @@ export default function Profile({
9595
<InputError className="mt-2" message={errors.email} />
9696
</div>
9797

98-
{mustVerifyEmail && auth.user.email_verified_at === null && (
98+
{mustVerifyEmail && auth.user?.email_verified_at === null && (
9999
<div>
100100
<p className="text-muted-foreground -mt-4 text-sm">
101101
{t('settings.profile.email_unverified')}{' '}

resources/js/types/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface User {
1414
created_at: string | null;
1515
updated_at: string | null;
1616
deleted_at: string | null;
17+
email_verified_at: string | null;
1718
avatar: string | null;
1819
can: Record<Permission, boolean>;
1920
}

0 commit comments

Comments
 (0)