added headers

This commit is contained in:
2025-10-29 14:34:12 -06:00
parent 3fd8415abd
commit dc74cb3671
2 changed files with 10 additions and 2 deletions
+4 -1
View File
@@ -98,7 +98,10 @@ export default function Page() {
};
const handleGuardar = async () => {
await axios.post(`${api_url}/equipos/crear`, formData);
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
await axios.post(`${api_url}/equipos/crear`, formData, { headers });
toast.success("Equipo guardado");
};
+6 -1
View File
@@ -80,8 +80,13 @@ export default function Editar() {
useEffect(() => {
const fetchEquipo = async () => {
const token = Cookies.get("token");
const headers = { Authorization: `Bearer ${token}` };
try {
const response = await axios.get(`${api_url}/equipos/${equipoId}`);
const response = await axios.get(`${api_url}/equipos/${equipoId}`, {
headers,
});
setFormData(response.data);
} catch (error) {
console.error("Error al obtener el equipo:", error);