feat: init project SelfChckout
This commit is contained in:
parent
765cc0c7cf
commit
9d31ea245c
62 changed files with 8869 additions and 7149 deletions
28
app/account/controller/AuthController.tsx
Normal file
28
app/account/controller/AuthController.tsx
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { BASE_URL_AUTHENTICATION } from "@package/config/ApiPath"
|
||||
import { FetchData } from "@package/config/FetchData"
|
||||
|
||||
async function auth(ae_user: string, ae_password: string): Promise<string> {
|
||||
const options: RequestInit = {
|
||||
method: "POST",
|
||||
// mode: 'cors',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username: ae_user,
|
||||
password: ae_password,
|
||||
}),
|
||||
}
|
||||
|
||||
const data = await FetchData<{ token: string }>(BASE_URL_AUTHENTICATION, "login", options)
|
||||
|
||||
console.log(data)
|
||||
if (data.correct) {
|
||||
return data.object.token
|
||||
} else {
|
||||
console.error("Error en la autenticación:", data.message)
|
||||
return "error en la autenticación"
|
||||
}
|
||||
}
|
||||
|
||||
export { auth }
|
||||
26
app/account/login/page.tsx
Normal file
26
app/account/login/page.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
"use client"
|
||||
import LoginForm from "@organisms/LoginForm"
|
||||
import React from "react"
|
||||
|
||||
const LoginPage: React.FC = () => {
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center bg-gradient-to-r from-blue-900 to-blue-700">
|
||||
<div className="w-full max-w-md rounded-lg bg-white p-10 shadow-lg">
|
||||
<h2 className="mb-8 text-center text-4xl font-bold text-blue-900">Iniciar Sesión</h2>
|
||||
|
||||
<LoginForm />
|
||||
|
||||
<div className="mt-4 text-center">
|
||||
<button
|
||||
onClick={() => alert("Recuperación de contraseña")} //TODO: Implement password recovery
|
||||
className="text-sm text-blue-600 hover:underline"
|
||||
>
|
||||
¿Olvidaste tu contraseña?
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default LoginPage
|
||||
Loading…
Add table
Add a link
Reference in a new issue