Skip to content

Commit 80866a4

Browse files
committed
Use Wayfinder conventions
1 parent 9a4a45b commit 80866a4

14 files changed

+68
-68
lines changed

resources/js/components/delete-user.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ import { Label } from '@/components/ui/label';
99
import HeadingSmall from '@/components/heading-small';
1010

1111
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger } from '@/components/ui/dialog';
12-
import { destroy as profileControllerDestroy } from '@/actions/App/Http/Controllers/Settings/ProfileController';
12+
import { destroy } from '@/actions/App/Http/Controllers/Settings/ProfileController';
1313

1414
export default function DeleteUser() {
1515
const passwordInput = useRef<HTMLInputElement>(null);
16-
const { data, setData, delete: destroy, processing, reset, errors, clearErrors } = useForm<Required<{ password: string }>>({ password: '' });
16+
const { data, setData, submit, processing, reset, errors, clearErrors } = useForm<Required<{ password: string }>>({ password: '' });
1717

1818
const deleteUser: FormEventHandler = (e) => {
1919
e.preventDefault();
2020

21-
destroy(profileControllerDestroy.url(), {
21+
submit(destroy(), {
2222
preserveScroll: true,
2323
onSuccess: () => closeModal(),
2424
onError: () => passwordInput.current?.focus(),

resources/js/components/user-menu-content.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { useMobileNavigation } from '@/hooks/use-mobile-navigation';
44
import { type User } from '@/types';
55
import { Link, router } from '@inertiajs/react';
66
import { LogOut, Settings } from 'lucide-react';
7-
import { edit as profileEditRoute } from '@/routes/profile';
8-
import { logout as logoutRoute } from '@/routes';
7+
import { edit } from '@/routes/profile';
8+
import { logout } from '@/routes';
99

1010
interface UserMenuContentProps {
1111
user: User;
@@ -29,15 +29,15 @@ export function UserMenuContent({ user }: UserMenuContentProps) {
2929
<DropdownMenuSeparator />
3030
<DropdownMenuGroup>
3131
<DropdownMenuItem asChild>
32-
<Link className="block w-full" href={profileEditRoute.url()} as="button" prefetch onClick={cleanup}>
32+
<Link className="block w-full" href={edit()} as="button" prefetch onClick={cleanup}>
3333
<Settings className="mr-2" />
3434
Settings
3535
</Link>
3636
</DropdownMenuItem>
3737
</DropdownMenuGroup>
3838
<DropdownMenuSeparator />
3939
<DropdownMenuItem asChild>
40-
<Link className="block w-full" method="post" href={logoutRoute.url()} as="button" onClick={handleLogout}>
40+
<Link className="block w-full" method="post" href={logout()} as="button" onClick={handleLogout}>
4141
<LogOut className="mr-2" />
4242
Log out
4343
</Link>

resources/js/layouts/auth/auth-card-layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import AppLogoIcon from '@/components/app-logo-icon';
22
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
33
import { Link } from '@inertiajs/react';
44
import { type PropsWithChildren } from 'react';
5-
import { home as homeRoute } from '@/routes';
5+
import { home } from '@/routes';
66

77
export default function AuthCardLayout({
88
children,
@@ -16,7 +16,7 @@ export default function AuthCardLayout({
1616
return (
1717
<div className="flex min-h-svh flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10">
1818
<div className="flex w-full max-w-md flex-col gap-6">
19-
<Link href={homeRoute.url()} className="flex items-center gap-2 self-center font-medium">
19+
<Link href={home()} className="flex items-center gap-2 self-center font-medium">
2020
<div className="flex h-9 w-9 items-center justify-center">
2121
<AppLogoIcon className="size-9 fill-current text-black dark:text-white" />
2222
</div>

resources/js/layouts/auth/auth-simple-layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import AppLogoIcon from '@/components/app-logo-icon';
22
import { Link } from '@inertiajs/react';
33
import { type PropsWithChildren } from 'react';
4-
import { home as homeRoute } from '@/routes';
4+
import { home } from '@/routes';
55

66
interface AuthLayoutProps {
77
name?: string;
@@ -15,7 +15,7 @@ export default function AuthSimpleLayout({ children, title, description }: Props
1515
<div className="w-full max-w-sm">
1616
<div className="flex flex-col gap-8">
1717
<div className="flex flex-col items-center gap-4">
18-
<Link href={homeRoute.url()} className="flex flex-col items-center gap-2 font-medium">
18+
<Link href={home()} className="flex flex-col items-center gap-2 font-medium">
1919
<div className="mb-1 flex h-9 w-9 items-center justify-center rounded-md">
2020
<AppLogoIcon className="size-9 fill-current text-[var(--foreground)] dark:text-white" />
2121
</div>

resources/js/layouts/auth/auth-split-layout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import AppLogoIcon from '@/components/app-logo-icon';
22
import { type SharedData } from '@/types';
33
import { Link, usePage } from '@inertiajs/react';
44
import { type PropsWithChildren } from 'react';
5-
import { home as homeRoute } from '@/routes';
5+
import { home } from '@/routes';
66

77
interface AuthLayoutProps {
88
title?: string;
@@ -16,7 +16,7 @@ export default function AuthSplitLayout({ children, title, description }: PropsW
1616
<div className="relative grid h-dvh flex-col items-center justify-center px-8 sm:px-0 lg:max-w-none lg:grid-cols-2 lg:px-0">
1717
<div className="relative hidden h-full flex-col bg-muted p-10 text-white lg:flex dark:border-r">
1818
<div className="absolute inset-0 bg-zinc-900" />
19-
<Link href={homeRoute.url()} className="relative z-20 flex items-center text-lg font-medium">
19+
<Link href={home()} className="relative z-20 flex items-center text-lg font-medium">
2020
<AppLogoIcon className="mr-2 size-8 fill-current text-white" />
2121
{name}
2222
</Link>
@@ -31,7 +31,7 @@ export default function AuthSplitLayout({ children, title, description }: PropsW
3131
</div>
3232
<div className="w-full lg:p-8">
3333
<div className="mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px]">
34-
<Link href={homeRoute.url()} className="relative z-20 flex items-center justify-center lg:hidden">
34+
<Link href={home()} className="relative z-20 flex items-center justify-center lg:hidden">
3535
<AppLogoIcon className="h-10 fill-current text-black sm:h-12" />
3636
</Link>
3737
<div className="flex flex-col items-start gap-2 text-left sm:items-center sm:text-center">

resources/js/pages/auth/confirm-password.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ import { Button } from '@/components/ui/button';
88
import { Input } from '@/components/ui/input';
99
import { Label } from '@/components/ui/label';
1010
import AuthLayout from '@/layouts/auth-layout';
11-
import { store as confirmablePasswordControllerStore } from '@/actions/App/Http/Controllers/Auth/ConfirmablePasswordController';
11+
import { store } from '@/actions/App/Http/Controllers/Auth/ConfirmablePasswordController';
1212

1313
export default function ConfirmPassword() {
14-
const { data, setData, post, processing, errors, reset } = useForm<Required<{ password: string }>>({
14+
const { data, setData, submit, processing, errors, reset } = useForm<Required<{ password: string }>>({
1515
password: '',
1616
});
1717

18-
const submit: FormEventHandler = (e) => {
18+
const submitForm: FormEventHandler = (e) => {
1919
e.preventDefault();
2020

21-
post(confirmablePasswordControllerStore.url(), {
21+
submit(store(), {
2222
onFinish: () => reset('password'),
2323
});
2424
};
@@ -30,7 +30,7 @@ export default function ConfirmPassword() {
3030
>
3131
<Head title="Confirm password" />
3232

33-
<form onSubmit={submit}>
33+
<form onSubmit={submitForm}>
3434
<div className="space-y-6">
3535
<div className="grid gap-2">
3636
<Label htmlFor="password">Password</Label>

resources/js/pages/auth/forgot-password.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ import { Button } from '@/components/ui/button';
99
import { Input } from '@/components/ui/input';
1010
import { Label } from '@/components/ui/label';
1111
import AuthLayout from '@/layouts/auth-layout';
12-
import { store as passwordResetLinkControllerStore } from '@/actions/App/Http/Controllers/Auth/PasswordResetLinkController';
13-
import { login as loginRoute } from '@/routes';
12+
import { store } from '@/actions/App/Http/Controllers/Auth/PasswordResetLinkController';
13+
import { login } from '@/routes';
1414

1515
export default function ForgotPassword({ status }: { status?: string }) {
16-
const { data, setData, post, processing, errors } = useForm<Required<{ email: string }>>({
16+
const { data, setData, submit, processing, errors } = useForm<Required<{ email: string }>>({
1717
email: '',
1818
});
1919

20-
const submit: FormEventHandler = (e) => {
20+
const submitForm: FormEventHandler = (e) => {
2121
e.preventDefault();
2222

23-
post(passwordResetLinkControllerStore.url());
23+
submit(store());
2424
};
2525

2626
return (
@@ -30,7 +30,7 @@ export default function ForgotPassword({ status }: { status?: string }) {
3030
{status && <div className="mb-4 text-center text-sm font-medium text-green-600">{status}</div>}
3131

3232
<div className="space-y-6">
33-
<form onSubmit={submit}>
33+
<form onSubmit={submitForm}>
3434
<div className="grid gap-2">
3535
<Label htmlFor="email">Email address</Label>
3636
<Input
@@ -57,7 +57,7 @@ export default function ForgotPassword({ status }: { status?: string }) {
5757

5858
<div className="space-x-1 text-center text-sm text-muted-foreground">
5959
<span>Or, return to</span>
60-
<TextLink href={loginRoute.url()}>log in</TextLink>
60+
<TextLink href={login()}>log in</TextLink>
6161
</div>
6262
</div>
6363
</AuthLayout>

resources/js/pages/auth/login.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { Checkbox } from '@/components/ui/checkbox';
99
import { Input } from '@/components/ui/input';
1010
import { Label } from '@/components/ui/label';
1111
import AuthLayout from '@/layouts/auth-layout';
12-
import { store as authenticatedSessionControllerStore } from '@/actions/App/Http/Controllers/Auth/AuthenticatedSessionController';
13-
import { register as registerRoute } from '@/routes';
14-
import { request as passwordRequestRoute } from '@/routes/password';
12+
import { store } from '@/actions/App/Http/Controllers/Auth/AuthenticatedSessionController';
13+
import { register } from '@/routes';
14+
import { request } from '@/routes/password';
1515

1616
type LoginForm = {
1717
email: string;
@@ -25,15 +25,15 @@ interface LoginProps {
2525
}
2626

2727
export default function Login({ status, canResetPassword }: LoginProps) {
28-
const { data, setData, post, processing, errors, reset } = useForm<Required<LoginForm>>({
28+
const { data, setData, submit, processing, errors, reset } = useForm<Required<LoginForm>>({
2929
email: '',
3030
password: '',
3131
remember: false,
3232
});
3333

34-
const submit: FormEventHandler = (e) => {
34+
const submitForm: FormEventHandler = (e) => {
3535
e.preventDefault();
36-
post(authenticatedSessionControllerStore.url(), {
36+
submit(store(), {
3737
onFinish: () => reset('password'),
3838
});
3939
};
@@ -42,7 +42,7 @@ export default function Login({ status, canResetPassword }: LoginProps) {
4242
<AuthLayout title="Log in to your account" description="Enter your email and password below to log in">
4343
<Head title="Log in" />
4444

45-
<form className="flex flex-col gap-6" onSubmit={submit}>
45+
<form className="flex flex-col gap-6" onSubmit={submitForm}>
4646
<div className="grid gap-6">
4747
<div className="grid gap-2">
4848
<Label htmlFor="email">Email address</Label>
@@ -64,7 +64,7 @@ export default function Login({ status, canResetPassword }: LoginProps) {
6464
<div className="flex items-center">
6565
<Label htmlFor="password">Password</Label>
6666
{canResetPassword && (
67-
<TextLink href={passwordRequestRoute.url()} className="ml-auto text-sm" tabIndex={5}>
67+
<TextLink href={request()} className="ml-auto text-sm" tabIndex={5}>
6868
Forgot password?
6969
</TextLink>
7070
)}
@@ -101,7 +101,7 @@ export default function Login({ status, canResetPassword }: LoginProps) {
101101

102102
<div className="text-center text-sm text-muted-foreground">
103103
Don't have an account?{' '}
104-
<TextLink href={registerRoute.url()} tabIndex={5}>
104+
<TextLink href={register()} tabIndex={5}>
105105
Sign up
106106
</TextLink>
107107
</div>

resources/js/pages/auth/register.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { Button } from '@/components/ui/button';
88
import { Input } from '@/components/ui/input';
99
import { Label } from '@/components/ui/label';
1010
import AuthLayout from '@/layouts/auth-layout';
11-
import { store as registeredUserControllerStore } from '@/actions/App/Http/Controllers/Auth/RegisteredUserController';
12-
import { login as loginRoute } from '@/routes';
11+
import { store } from '@/actions/App/Http/Controllers/Auth/RegisteredUserController';
12+
import { login } from '@/routes';
1313

1414
type RegisterForm = {
1515
name: string;
@@ -19,24 +19,24 @@ type RegisterForm = {
1919
};
2020

2121
export default function Register() {
22-
const { data, setData, post, processing, errors, reset } = useForm<Required<RegisterForm>>({
22+
const { data, setData, submit, processing, errors, reset } = useForm<Required<RegisterForm>>({
2323
name: '',
2424
email: '',
2525
password: '',
2626
password_confirmation: '',
2727
});
2828

29-
const submit: FormEventHandler = (e) => {
29+
const submitForm: FormEventHandler = (e) => {
3030
e.preventDefault();
31-
post(registeredUserControllerStore.url(), {
31+
submit(store(), {
3232
onFinish: () => reset('password', 'password_confirmation'),
3333
});
3434
};
3535

3636
return (
3737
<AuthLayout title="Create an account" description="Enter your details below to create your account">
3838
<Head title="Register" />
39-
<form className="flex flex-col gap-6" onSubmit={submit}>
39+
<form className="flex flex-col gap-6" onSubmit={submitForm}>
4040
<div className="grid gap-6">
4141
<div className="grid gap-2">
4242
<Label htmlFor="name">Name</Label>
@@ -111,7 +111,7 @@ export default function Register() {
111111

112112
<div className="text-center text-sm text-muted-foreground">
113113
Already have an account?{' '}
114-
<TextLink href={loginRoute.url()} tabIndex={6}>
114+
<TextLink href={login()} tabIndex={6}>
115115
Log in
116116
</TextLink>
117117
</div>

resources/js/pages/auth/reset-password.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Button } from '@/components/ui/button';
77
import { Input } from '@/components/ui/input';
88
import { Label } from '@/components/ui/label';
99
import AuthLayout from '@/layouts/auth-layout';
10-
import { store as newPasswordControllerStore } from '@/actions/App/Http/Controllers/Auth/NewPasswordController';
10+
import { store } from '@/actions/App/Http/Controllers/Auth/NewPasswordController';
1111

1212
interface ResetPasswordProps {
1313
token: string;
@@ -22,16 +22,16 @@ type ResetPasswordForm = {
2222
};
2323

2424
export default function ResetPassword({ token, email }: ResetPasswordProps) {
25-
const { data, setData, post, processing, errors, reset } = useForm<Required<ResetPasswordForm>>({
25+
const { data, setData, submit, processing, errors, reset } = useForm<Required<ResetPasswordForm>>({
2626
token: token,
2727
email: email,
2828
password: '',
2929
password_confirmation: '',
3030
});
3131

32-
const submit: FormEventHandler = (e) => {
32+
const submitForm: FormEventHandler = (e) => {
3333
e.preventDefault();
34-
post(newPasswordControllerStore.url(), {
34+
submit(store(), {
3535
onFinish: () => reset('password', 'password_confirmation'),
3636
});
3737
};
@@ -40,7 +40,7 @@ export default function ResetPassword({ token, email }: ResetPasswordProps) {
4040
<AuthLayout title="Reset password" description="Please enter your new password below">
4141
<Head title="Reset password" />
4242

43-
<form onSubmit={submit}>
43+
<form onSubmit={submitForm}>
4444
<div className="grid gap-6">
4545
<div className="grid gap-2">
4646
<Label htmlFor="email">Email</Label>

0 commit comments

Comments
 (0)