feat: Fixed path for routes
This commit is contained in:
@ -34,13 +34,27 @@ class MapStore {
|
||||
getRoutes = async () => {
|
||||
const routes = await languageInstance("ru").get("/route");
|
||||
|
||||
const mappedRoutes = routes.data.map((route: any) => ({
|
||||
id: route.id,
|
||||
route_number: route.route_number,
|
||||
path: route.path,
|
||||
}));
|
||||
const routedIds = routes.data.map((route: any) => route.id);
|
||||
|
||||
this.routes = mappedRoutes;
|
||||
const mappedRoutes: ApiRoute[] = [];
|
||||
for (const routeId of routedIds) {
|
||||
const responseSoloRoute = await languageInstance("ru").get(
|
||||
`/route/${routeId}`
|
||||
);
|
||||
const route = responseSoloRoute.data;
|
||||
|
||||
const mappedRoute = {
|
||||
id: route.id,
|
||||
route_number: route.route_number,
|
||||
path: route.path,
|
||||
};
|
||||
|
||||
mappedRoutes.push(mappedRoute);
|
||||
}
|
||||
|
||||
this.routes = mappedRoutes.sort((a, b) =>
|
||||
a.route_number.localeCompare(b.route_number)
|
||||
);
|
||||
};
|
||||
|
||||
getStations = async () => {
|
||||
|
Reference in New Issue
Block a user