added request to api

This commit is contained in:
2025-09-19 17:20:05 -06:00
parent 33060b5dbb
commit ca67be2de3
14 changed files with 296 additions and 254 deletions
+13 -10
View File
@@ -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 };
}
}