feat: Add checkbox for sightbar
entity + fix build errors
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { authInstance, languageStore } from "@shared";
|
||||
import { authInstance } from "@shared";
|
||||
import { makeAutoObservable, runInAction } from "mobx";
|
||||
|
||||
export type Carrier = {
|
||||
|
@ -1,73 +0,0 @@
|
||||
import { authInstance, languageInstance } from "@shared";
|
||||
import { makeAutoObservable, runInAction } from "mobx";
|
||||
|
||||
type City = {
|
||||
id: number;
|
||||
name: string;
|
||||
country_code: string;
|
||||
country: string;
|
||||
arms?: string;
|
||||
};
|
||||
|
||||
class CityStore {
|
||||
cities: City[] = [];
|
||||
ruCities: City[] = [];
|
||||
city: City | null = null;
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
getCities = async () => {
|
||||
const response = await authInstance.get("/city");
|
||||
|
||||
runInAction(() => {
|
||||
this.cities = response.data;
|
||||
});
|
||||
};
|
||||
|
||||
getRuCities = async () => {
|
||||
const response = await languageInstance("ru").get("/city");
|
||||
|
||||
runInAction(() => {
|
||||
this.ruCities = response.data;
|
||||
});
|
||||
};
|
||||
|
||||
deleteCity = async (id: number) => {
|
||||
await authInstance.delete(`/city/${id}`);
|
||||
|
||||
runInAction(() => {
|
||||
this.cities = this.cities.filter((city) => city.id !== id);
|
||||
});
|
||||
};
|
||||
|
||||
getCity = async (id: string) => {
|
||||
const response = await authInstance.get(`/city/${id}`);
|
||||
|
||||
runInAction(() => {
|
||||
this.city = response.data;
|
||||
});
|
||||
|
||||
return response.data;
|
||||
};
|
||||
|
||||
createCity = async (
|
||||
name: string,
|
||||
country: string,
|
||||
countryCode: string,
|
||||
mediaId: string
|
||||
) => {
|
||||
const response = await authInstance.post("/city", {
|
||||
name: name,
|
||||
country: country,
|
||||
country_code: countryCode,
|
||||
arms: mediaId,
|
||||
});
|
||||
runInAction(() => {
|
||||
this.cities.push(response.data);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// export const cityStore = new CityStore();
|
@ -256,14 +256,17 @@ class StationsStore {
|
||||
// Update the cached preview data and station lists after successful patch
|
||||
if (this.stationPreview[id]) {
|
||||
this.stationPreview[id][language] = {
|
||||
...this.stationPreview[id][language], // Preserve common fields that might not be in the language-specific patch response
|
||||
id: response.data.id,
|
||||
name: response.data.name,
|
||||
system_name: response.data.system_name,
|
||||
description: response.data.description,
|
||||
address: response.data.address,
|
||||
...commonDataPayload,
|
||||
} as Station; // Cast to Station to satisfy type
|
||||
loaded: true,
|
||||
data: {
|
||||
...this.stationPreview[id][language].data,
|
||||
id: response.data.id,
|
||||
name: response.data.name,
|
||||
system_name: response.data.system_name,
|
||||
description: response.data.description,
|
||||
address: response.data.address,
|
||||
...commonDataPayload,
|
||||
} as Station,
|
||||
};
|
||||
}
|
||||
if (this.stationLists[language].data) {
|
||||
this.stationLists[language].data = this.stationLists[
|
||||
@ -327,8 +330,8 @@ class StationsStore {
|
||||
};
|
||||
}
|
||||
this.stationPreview[id][language] = {
|
||||
data: response.data,
|
||||
loaded: true,
|
||||
data: response.data as Station,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { authInstance, languageStore, languageInstance } from "@shared";
|
||||
import { languageInstance } from "@shared";
|
||||
import { makeAutoObservable, runInAction } from "mobx";
|
||||
|
||||
export type Vehicle = {
|
||||
|
Reference in New Issue
Block a user