feat: Rewrite to use the Diyanet API
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const app = () => ({
|
||||
futureTimes: [],
|
||||
|
||||
locationId: Alpine.$persist('11104'),
|
||||
locationId: Alpine.$persist('11002'),
|
||||
lastUpdated: Alpine.$persist(null),
|
||||
userMinutes: 0,
|
||||
now: new Date(),
|
||||
@@ -47,9 +47,11 @@ const app = () => ({
|
||||
const elapsedSeconds = (now - updatedAt) / 1000;
|
||||
|
||||
if (this.geolocation !== null) {
|
||||
this.futureTimes = await fetchJSON(`/api/v1/diyanet/prayertimes?latitude=${this.geolocation.latitude}&longitude=${this.geolocation.longitude}`);
|
||||
const response = await fetchJSON(`/api/v1/diyanet/prayertimes?latitude=${this.geolocation.latitude}&longitude=${this.geolocation.longitude}`);
|
||||
this.futureTimes = response.prayertimes ?? [];
|
||||
} else {
|
||||
this.futureTimes = await fetchJSON(`/api/v1/diyanet/prayertimes?location_id=${this.locationId}`);
|
||||
const response = await fetchJSON(`/api/v1/diyanet/prayertimes?location_id=${this.locationId}`);
|
||||
this.futureTimes = response.prayertimes ?? [];
|
||||
}
|
||||
this.lastUpdated = now.toISOString();
|
||||
},
|
||||
@@ -205,4 +207,4 @@ function getUserLocation() {
|
||||
(error) => reject(error.message)
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user