fix: Fix Map page
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { authInstance } from "@shared";
|
||||
import { authInstance, cityStore, languageStore } from "@shared";
|
||||
import { makeAutoObservable, runInAction } from "mobx";
|
||||
|
||||
export type Carrier = {
|
||||
@@ -9,9 +9,9 @@ export type Carrier = {
|
||||
city: string;
|
||||
city_id: number;
|
||||
logo: string;
|
||||
main_color: string;
|
||||
left_color: string;
|
||||
right_color: string;
|
||||
// main_color: string;
|
||||
// left_color: string;
|
||||
// right_color: string;
|
||||
};
|
||||
|
||||
type Carriers = {
|
||||
@@ -68,9 +68,9 @@ class CarrierStore {
|
||||
city: "",
|
||||
city_id: 0,
|
||||
logo: "",
|
||||
main_color: "",
|
||||
left_color: "",
|
||||
right_color: "",
|
||||
// main_color: "",
|
||||
// left_color: "",
|
||||
// right_color: "",
|
||||
};
|
||||
}
|
||||
this.carrier[id] = response.data;
|
||||
@@ -81,22 +81,22 @@ class CarrierStore {
|
||||
createCarrier = async (
|
||||
fullName: string,
|
||||
shortName: string,
|
||||
city: string,
|
||||
|
||||
cityId: number,
|
||||
main_color: string,
|
||||
left_color: string,
|
||||
right_color: string,
|
||||
// main_color: string,
|
||||
// left_color: string,
|
||||
// right_color: string,
|
||||
slogan: string,
|
||||
logoId: string
|
||||
) => {
|
||||
const response = await authInstance.post("/carrier", {
|
||||
full_name: fullName,
|
||||
short_name: shortName,
|
||||
city,
|
||||
city: "",
|
||||
city_id: cityId,
|
||||
main_color,
|
||||
left_color,
|
||||
right_color,
|
||||
// main_color,
|
||||
// left_color,
|
||||
// right_color,
|
||||
slogan,
|
||||
logo: logoId,
|
||||
});
|
||||
@@ -108,11 +108,11 @@ class CarrierStore {
|
||||
editCarrierData = {
|
||||
full_name: "",
|
||||
short_name: "",
|
||||
city: "",
|
||||
|
||||
city_id: 0,
|
||||
main_color: "",
|
||||
left_color: "",
|
||||
right_color: "",
|
||||
// main_color: "",
|
||||
// left_color: "",
|
||||
// right_color: "",
|
||||
slogan: "",
|
||||
logo: "",
|
||||
};
|
||||
@@ -120,32 +120,35 @@ class CarrierStore {
|
||||
setEditCarrierData = (
|
||||
fullName: string,
|
||||
shortName: string,
|
||||
city: string,
|
||||
|
||||
cityId: number,
|
||||
main_color: string,
|
||||
left_color: string,
|
||||
right_color: string,
|
||||
// main_color: string,
|
||||
// left_color: string,
|
||||
// right_color: string,
|
||||
slogan: string,
|
||||
logoId: string
|
||||
) => {
|
||||
this.editCarrierData = {
|
||||
full_name: fullName,
|
||||
short_name: shortName,
|
||||
city,
|
||||
|
||||
city_id: cityId,
|
||||
main_color: main_color,
|
||||
left_color: left_color,
|
||||
right_color: right_color,
|
||||
// main_color: main_color,
|
||||
// left_color: left_color,
|
||||
// right_color: right_color,
|
||||
slogan: slogan,
|
||||
logo: logoId,
|
||||
};
|
||||
};
|
||||
|
||||
editCarrier = async (id: number) => {
|
||||
const response = await authInstance.patch(
|
||||
`/carrier/${id}`,
|
||||
this.editCarrierData
|
||||
);
|
||||
const { language } = languageStore;
|
||||
const response = await authInstance.patch(`/carrier/${id}`, {
|
||||
...this.editCarrierData,
|
||||
city: cityStore.cities[language].data.find(
|
||||
(city) => city.id === this.editCarrierData.city_id
|
||||
)?.name,
|
||||
});
|
||||
|
||||
runInAction(() => {
|
||||
this.carriers.data = this.carriers.data.map((carrier) =>
|
||||
|
||||
Reference in New Issue
Block a user