commit wip
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { createFileRoute, redirect } from "@tanstack/react-router"
|
||||
import { createFileRoute, redirect, useRouter } from "@tanstack/react-router"
|
||||
import { useState } from "react"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
@@ -27,6 +27,7 @@ function LoginComponent() {
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [error, setError] = useState("")
|
||||
const [showPassword, setShowPassword] = useState(false)
|
||||
const router = useRouter()
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
@@ -35,7 +36,7 @@ function LoginComponent() {
|
||||
|
||||
try {
|
||||
await auth.login(email, password)
|
||||
window.location.href = redirect
|
||||
router.navigate({ to: redirect})
|
||||
} catch (err: any) {
|
||||
setError(err.message || "No fue posible iniciar sesión")
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user