feat: update map, admin to and cache
This commit is contained in:
@@ -120,6 +120,7 @@ class VehicleStore {
|
||||
carrier: string,
|
||||
carrierId: number,
|
||||
model?: string,
|
||||
cityId?: number,
|
||||
) => {
|
||||
const payload: Record<string, unknown> = {
|
||||
tail_number: tailNumber.trim(),
|
||||
@@ -129,6 +130,7 @@ class VehicleStore {
|
||||
};
|
||||
// TODO: когда будет бекенд — добавить model в payload и в ответ
|
||||
if (model != null && model !== "") payload.model = model;
|
||||
if (cityId != null) payload.city_id = cityId;
|
||||
const response = await languageInstance("ru").post("/vehicle", payload);
|
||||
const normalizedVehicle = this.normalizeVehicleItem(response.data);
|
||||
|
||||
@@ -147,6 +149,7 @@ class VehicleStore {
|
||||
carrier_id: number;
|
||||
model: string;
|
||||
snapshot_update_blocked: boolean;
|
||||
city_id?: number;
|
||||
} = {
|
||||
tail_number: "",
|
||||
type: 0,
|
||||
@@ -154,6 +157,7 @@ class VehicleStore {
|
||||
carrier_id: 0,
|
||||
model: "",
|
||||
snapshot_update_blocked: false,
|
||||
city_id: undefined,
|
||||
};
|
||||
|
||||
setEditVehicleData = (data: {
|
||||
@@ -163,6 +167,7 @@ class VehicleStore {
|
||||
carrier_id: number;
|
||||
model?: string;
|
||||
snapshot_update_blocked?: boolean;
|
||||
city_id?: number;
|
||||
}) => {
|
||||
this.editVehicleData = {
|
||||
...this.editVehicleData,
|
||||
@@ -179,6 +184,7 @@ class VehicleStore {
|
||||
carrier_id: number;
|
||||
model?: string;
|
||||
snapshot_update_blocked?: boolean;
|
||||
city_id?: number;
|
||||
},
|
||||
) => {
|
||||
const payload: Record<string, unknown> = {
|
||||
@@ -190,6 +196,7 @@ class VehicleStore {
|
||||
if (data.model != null && data.model !== "") payload.model = data.model;
|
||||
if (data.snapshot_update_blocked != null)
|
||||
payload.snapshot_update_blocked = data.snapshot_update_blocked;
|
||||
if (data.city_id != null) payload.city_id = data.city_id;
|
||||
const response = await languageInstance("ru").patch(
|
||||
`/vehicle/${id}`,
|
||||
payload,
|
||||
|
||||
Reference in New Issue
Block a user