Skip to content

Commit

Permalink
feat: add api connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyp3Boy committed Oct 31, 2024
1 parent 7639506 commit 061df71
Show file tree
Hide file tree
Showing 35 changed files with 2,976 additions and 275 deletions.
69 changes: 11 additions & 58 deletions api/complaints.ts
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);
});
};
18 changes: 13 additions & 5 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@
"backgroundColor": "#FFFFFF"
},
"ios": {
"supportsTablet": true
"supportsTablet": true,
"bundleIdentifier": "mayllu-frontend"
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/splash_mayllu.png",
"backgroundColor": "#ffffff",
}
"backgroundColor": "#ffffff"
},
"permissions": [
"android.permission.ACCESS_COARSE_LOCATION",
"android.permission.ACCESS_FINE_LOCATION",
"android.permission.ACCESS_BACKGROUND_LOCATION",
"android.permission.FOREGROUND_SERVICE",
"android.permission.FOREGROUND_SERVICE_LOCATION"
]
},
"web": {
"favicon": "./assets/logo_mayllu.png",
"favicon": "./assets/logo_mayllu.png"
},
"experiments": {
"tsConfigPaths": true,
"typedRoutes": true,
"typedRoutes": true
},
"plugins": [
"expo-router",
Expand Down
Loading

0 comments on commit 061df71

Please sign in to comment.