added request to api
This commit is contained in:
+13
-10
@@ -2,14 +2,17 @@ import axios from "axios";
|
||||
import { envConfig } from "./config";
|
||||
|
||||
export async function loginUser(usuario: string, password: string) {
|
||||
try {
|
||||
const response = await axios.post(`${envConfig.apiUrl}/user`, { usuario, password });
|
||||
return response.data;
|
||||
} catch (error: any) {
|
||||
const msg =
|
||||
error.response?.data?.message ||
|
||||
error.message ||
|
||||
"Error desconocido en el login";
|
||||
return { error: msg };
|
||||
}
|
||||
try {
|
||||
const response = await axios.post(`${envConfig.apiUrl}/user`, {
|
||||
usuario,
|
||||
password,
|
||||
});
|
||||
return response.data;
|
||||
} catch (error: any) {
|
||||
const msg =
|
||||
error.response?.data?.message ||
|
||||
error.message ||
|
||||
"Error desconocido en el login";
|
||||
return { error: msg };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user