fix: Hot bug fix
This commit is contained in:
@@ -85,7 +85,7 @@ class CityStore {
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await authInstance.get(`/city`);
|
||||
const response = await languageInstance(language).get(`/city`);
|
||||
|
||||
runInAction(() => {
|
||||
this.cities[language].data = response.data;
|
||||
@@ -98,7 +98,7 @@ class CityStore {
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await authInstance.get(`/city/${code}`);
|
||||
const response = await languageInstance(language).get(`/city/${code}`);
|
||||
|
||||
runInAction(() => {
|
||||
if (!this.city[code]) {
|
||||
@@ -170,15 +170,20 @@ class CityStore {
|
||||
|
||||
try {
|
||||
// Create city in primary language
|
||||
const cityResponse = await languageInstance(language).post("/city", {
|
||||
const cityPayload = {
|
||||
name,
|
||||
country:
|
||||
countryStore.countries[language as keyof CashedCountries]?.data.find(
|
||||
(c) => c.code === country_code
|
||||
)?.name || "",
|
||||
country_code,
|
||||
arms: arms || "",
|
||||
});
|
||||
...(arms ? { arms } : {}),
|
||||
};
|
||||
|
||||
const cityResponse = await languageInstance(language).post(
|
||||
"/city",
|
||||
cityPayload
|
||||
);
|
||||
|
||||
const cityId = cityResponse.data.id;
|
||||
|
||||
@@ -194,14 +199,16 @@ class CityStore {
|
||||
(c) => c.code === country_code
|
||||
)?.name || "";
|
||||
|
||||
const patchPayload = {
|
||||
name: secondaryName || "",
|
||||
country: countryName,
|
||||
country_code: country_code || "",
|
||||
...(arms ? { arms } : {}),
|
||||
};
|
||||
|
||||
const patchResponse = await languageInstance(secondaryLanguage).patch(
|
||||
`/city/${cityId}`,
|
||||
{
|
||||
name: secondaryName || "",
|
||||
country: countryName,
|
||||
country_code: country_code || "",
|
||||
arms: arms || "",
|
||||
}
|
||||
patchPayload
|
||||
);
|
||||
|
||||
runInAction(() => {
|
||||
|
||||
Reference in New Issue
Block a user