feat: Add dedicated login and logout routes, refactor Supabase environment variables, and update registration form UI.
This commit is contained in:
@@ -21,7 +21,9 @@ export const Route = createRootRouteWithContext<MyRouterContext>()({
|
||||
if (typeof document !== "undefined") {
|
||||
document.documentElement.setAttribute("lang", getLocale())
|
||||
}
|
||||
return await user.userData()
|
||||
return {
|
||||
user: await user.userData()
|
||||
}
|
||||
},
|
||||
head: () => ({
|
||||
meta: [
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
import { Button, Form, Input, Label, Spinner } from "@heroui/react"
|
||||
import {
|
||||
Button,
|
||||
FieldError,
|
||||
Fieldset,
|
||||
Form,
|
||||
Input,
|
||||
Label,
|
||||
Spinner,
|
||||
TextField
|
||||
} from "@heroui/react"
|
||||
import { createFileRoute } from "@tanstack/react-router"
|
||||
import { LogIn } from "lucide-react"
|
||||
import { useSignup } from "@/lib/hooks/useSignup"
|
||||
@@ -29,28 +38,32 @@ function RouteComponent() {
|
||||
return (
|
||||
<div>
|
||||
<Form onSubmit={handleFormSubmit} className="flex flex-col gap-4">
|
||||
<Label isRequired className="ml-4 text-lg">
|
||||
Correo
|
||||
</Label>
|
||||
<Input
|
||||
placeholder="Introduce tu correo"
|
||||
type="email"
|
||||
name="email"
|
||||
variant="secondary"
|
||||
className="py-4 text-lg "
|
||||
required
|
||||
/>
|
||||
<Label isRequired className="ml-4 text-lg">
|
||||
Contraseña
|
||||
</Label>
|
||||
<Input
|
||||
placeholder="Introduce tu contraseña"
|
||||
<Fieldset>
|
||||
<Fieldset.Group>
|
||||
<TextField
|
||||
type="email"
|
||||
name="email"
|
||||
variant="secondary"
|
||||
className="py-4 text-lg"
|
||||
isRequired
|
||||
>
|
||||
<Label>Correo</Label>
|
||||
<Input placeholder="Introduce tu correo" />
|
||||
<FieldError />
|
||||
</TextField>
|
||||
</Fieldset.Group>
|
||||
</Fieldset>
|
||||
<TextField
|
||||
type="password"
|
||||
name="password"
|
||||
variant="secondary"
|
||||
className="py-4 text-lg "
|
||||
required
|
||||
/>
|
||||
className="py-4 text-lg"
|
||||
isRequired
|
||||
>
|
||||
<Label>Contraseña</Label>
|
||||
<Input placeholder="Introduce tu contraseña" />
|
||||
<FieldError />
|
||||
</TextField>
|
||||
<div className="flex justify-end">
|
||||
<Button
|
||||
type="submit"
|
||||
|
||||
11
src/routes/login.tsx
Normal file
11
src/routes/login.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { createFileRoute, redirect } from "@tanstack/react-router"
|
||||
|
||||
export const Route = createFileRoute("/login")({
|
||||
beforeLoad: () => {
|
||||
redirect({
|
||||
to: "/access/login",
|
||||
replace: true,
|
||||
throw: true
|
||||
})
|
||||
}
|
||||
})
|
||||
5
src/routes/logout.tsx
Normal file
5
src/routes/logout.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { createFileRoute } from "@tanstack/react-router"
|
||||
|
||||
export const Route = createFileRoute("/logout")({
|
||||
beforeLoad: async ({ context }) => {}
|
||||
})
|
||||
Reference in New Issue
Block a user