-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
2,976 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,15 @@ | ||
import { ComplaintPointInterface } from "@/types"; | ||
|
||
const mockComplaints: ComplaintPointInterface[] = [ | ||
{ | ||
userId: "72671060", | ||
title: "Pista en mal estado - UTEC", | ||
image: "https://i.ibb.co/Lt3t7Gb/pic1.jpg", | ||
description: "Baches profundos frente a UTEC que dificultan el tránsito", | ||
latitude: "-12.093938", | ||
longitude: "-77.026048", | ||
categoryId: 1, | ||
districtId: 1 | ||
}, | ||
{ | ||
userId: "72671061", | ||
image: "https://i.ibb.co/Lt3t7Gb/pic1.jpg", | ||
title: "Semáforo malogrado - Javier Prado", | ||
description: "Semáforo sin funcionar en cruce peligroso", | ||
latitude: "-12.091213", | ||
longitude: "-77.022510", | ||
categoryId: 2, | ||
districtId: 2 | ||
}, | ||
{ | ||
userId: "72671062", | ||
image: "https://i.ibb.co/Lt3t7Gb/pic1.jpg", | ||
title: "Obras inconclusas - Miraflores", | ||
description: "Obra abandonada hace más de un mes, genera congestión", | ||
latitude: "-12.119896", | ||
longitude: "-77.030219", | ||
categoryId: 1, | ||
districtId: 3 | ||
}, | ||
{ | ||
userId: "72671063", | ||
image: "https://i.ibb.co/Lt3t7Gb/pic1.jpg", | ||
title: "Falta señalización - San Isidro", | ||
description: "No hay señales de tránsito en intersección peligrosa", | ||
latitude: "-12.092882", | ||
longitude: "-77.027951", | ||
categoryId: 3, | ||
districtId: 4 | ||
}, | ||
{ | ||
userId: "72671064", | ||
title: "Congestión vehicular - La Victoria", | ||
image: "https://i.ibb.co/Lt3t7Gb/pic1.jpg", | ||
description: "Paradero informal genera caos vehicular", | ||
latitude: "-12.088942", | ||
longitude: "-77.027453", | ||
categoryId: 4, | ||
districtId: 5 | ||
export const fetchComplaints = async (): Promise<ComplaintPointInterface[]> => { | ||
try { | ||
const response = await fetch("http://localhost:5555/api/complaints"); | ||
if (!response.ok) { | ||
throw new Error(`Error en la solicitud: ${response.statusText}`); | ||
} | ||
const data = await response.json(); | ||
return data as ComplaintPointInterface[]; | ||
} catch (error) { | ||
console.error("Error al obtener las quejas:", error); | ||
return []; | ||
} | ||
]; | ||
|
||
export const fetchComplaints = async () => { | ||
return new Promise<ComplaintPointInterface[]>((resolve) => { | ||
setTimeout(() => { | ||
resolve(mockComplaints); | ||
}, 800); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.