+
@@ -9,13 +9,13 @@
diff --git a/src/utils/fetcher.ts b/src/utils/fetcher.ts
index 0e727e0..6d3d457 100644
--- a/src/utils/fetcher.ts
+++ b/src/utils/fetcher.ts
@@ -13,7 +13,7 @@ export type VisitType = {
time: Date,
- plateform: string,
+ platform: string,
arrivalTime: Date,
arrivalStatus: string,
departureTime: Date,
@@ -104,7 +104,7 @@ const formatData = (visit: any) => {
time: new Date(mvjmc?.ExpectedDepartureTime),
- plateform: mvjmc?.ArrivalPlatformName?.value,
+ platform: mvjmc?.ArrivalPlatformName?.value,
arrivalTime: mvjmc?.ExpectedArrivalTime && new Date(mvjmc.ExpectedArrivalTime),
arrivalStatus: mvjmc?.ArrivalStatus,
departureTime: mvjmc?.ExpectedDepartureTime && new Date(mvjmc.ExpectedDepartureTime),
diff --git a/src/utils/localstore/synchronizer.ts b/src/utils/localstore/synchronizer.ts
index 6128bc9..4746d80 100644
--- a/src/utils/localstore/synchronizer.ts
+++ b/src/utils/localstore/synchronizer.ts
@@ -8,11 +8,11 @@ export const lastUpdatedAt = () => {
export const synchronize = async () => {
const lines = await synchronizeFile('/schemas/lines.json', 'lines')
-
- for (const line of Object.values(lines) as any[]) {
- synchronizeLine(line.slugName)
- }
- localStorage.setItem('lines.updatedAt', new Date().toISOString())
+ return Promise.all(
+ Object.values(lines).map((line: any) => synchronizeLine(line.slugName)),
+ ).then(() => {
+ localStorage.setItem('lines.updatedAt', new Date().toISOString())
+ })
}
export const synchronizeLine = async (line: string) => {
diff --git a/src/utils/datetime.ts b/src/utils/time.ts
similarity index 75%
rename from src/utils/datetime.ts
rename to src/utils/time.ts
index 80c2e9e..d7d3717 100644
--- a/src/utils/datetime.ts
+++ b/src/utils/time.ts
@@ -1,10 +1,10 @@
-export type DateTime = {
+export type Time = {
hh: string,
mm: string,
ss: string
}
-export const toDateTime = (date: Date) => {
+export const toTime = (date: Date) => {
return {
hh: date.getHours().toString(),
mm: date.getMinutes().toString().padStart(2, '0'),