ref: change in different components
This commit is contained in:
parent
a440f954ad
commit
0a14fe8882
6 changed files with 106 additions and 37 deletions
|
|
@ -1,28 +0,0 @@
|
|||
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 }
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
"use client";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import ForgotPasswordForm from "@organisms/ForgotPasswordForm";
|
||||
import LoginForm from "@organisms/LoginForm";
|
||||
import ForgotPasswordForm from "@organisms/Auth/ForgotPasswordForm";
|
||||
import LoginForm from "@organisms/Auth/LoginForm";
|
||||
|
||||
const LoginPage: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue