Refactor naming of tracked trip to leg

This commit is contained in:
2025-07-06 16:05:03 +02:00
parent ca35dbf92b
commit 4871052a4b
3 changed files with 73 additions and 77 deletions

View File

@@ -55,25 +55,25 @@ export class RecentLocationsDataStore {
}
}
export class TrackedTripsDataStore {
export class LegsDataStore {
constructor() {
this.data = [];
this.read();
}
read() {
this.data = DataStore.get("tracked-trips") || [];
this.data = DataStore.get("legs") || [];
}
write() {
DataStore.set("tracked-trips", this.data);
DataStore.set("legs", this.data);
}
remember(trip_id, origin_id, destination_id) {
this.data.push({
trip: trip_id,
origin: origin_id,
destination: destination_id,
trip_id: trip_id,
origin_location_id: origin_id,
destination_location_id: destination_id,
});
this.write();
@@ -119,7 +119,7 @@ export class DataStore {
constructor() {
this.locations = new LocationsDataStore();
this.recent_locations = new RecentLocationsDataStore();
this.tracked_trips = new TrackedTripsDataStore();
this.legs = new LegsDataStore();
this.trips = new TripsDataStore();
}
}