feat: update demo page + add city_id for media and articles

This commit is contained in:
2026-04-28 10:57:42 +03:00
parent 60c6840db4
commit 94f512e0e4
27 changed files with 499 additions and 222 deletions

View File

@@ -4,6 +4,7 @@ import {
authInstance,
languageInstance,
mediaStore,
selectedCityStore,
} from "@shared";
import { makeAutoObservable, runInAction } from "mobx";
@@ -129,6 +130,7 @@ class CreateSightStore {
zh: articleZhData.body,
},
},
...(selectedCityStore.selectedCityId ? { city_id: selectedCityStore.selectedCityId } : {}),
});
const { id } = articleRes.data;
@@ -346,6 +348,7 @@ class CreateSightStore {
const response = await languageInstance("ru").post("/article", {
heading: hasAnyName ? ruName : "",
body: "",
...(selectedCityStore.selectedCityId ? { city_id: selectedCityStore.selectedCityId } : {}),
});
const newLeftArticleId = response.data.id;
@@ -449,6 +452,7 @@ class CreateSightStore {
const res = await languageInstance("ru").post("/article", {
heading: this.sight.ru.left.heading,
body: this.sight.ru.left.body,
...(selectedCityStore.selectedCityId ? { city_id: selectedCityStore.selectedCityId } : {}),
});
finalLeftArticleId = res.data.id;
await languageInstance("en").patch(`/article/${finalLeftArticleId}`, {
@@ -567,6 +571,9 @@ class CreateSightStore {
formData.append("filename", filename);
if (media_name) formData.append("media_name", media_name);
formData.append("type", type.toString());
if (selectedCityStore.selectedCityId) {
formData.append("city_id", selectedCityStore.selectedCityId.toString());
}
try {
const response = await authInstance.post(`/media`, formData);