mirror of
https://github.com/Spythere/station-manager-2.0.git
synced 2026-05-03 13:38:13 +00:00
Przywrócono zmianę nazwy scenerii i usuwanie
This commit is contained in:
@@ -226,7 +226,7 @@ export default defineComponent({
|
||||
this.store.stationList[index]['routes'] = routeString;
|
||||
this.currentRoutes = routeString;
|
||||
|
||||
this.addChange(this.store.currentStation!.name, 'routes', this.routeBackup, routeString);
|
||||
this.addChange(this.store.currentStation!, 'routes', this.routeBackup, routeString);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -108,11 +108,16 @@ export default defineComponent({
|
||||
|
||||
async updateListToDb() {
|
||||
try {
|
||||
const mappedChangeList = Object.entries(this.store.changeList).map(([k, v]) => {
|
||||
return { name: k, ...v };
|
||||
const mappedChangeList = Object.entries(this.store.changeList).map(([id, v]) => {
|
||||
if (/^#/.test(id)) {
|
||||
delete v.id;
|
||||
return { ...v };
|
||||
}
|
||||
|
||||
return { id: id, ...v };
|
||||
});
|
||||
|
||||
await axios.post(
|
||||
const response = await axios.post(
|
||||
`${this.API_URL}/manager/updateSceneryList`,
|
||||
{
|
||||
changeList: mappedChangeList,
|
||||
@@ -127,10 +132,12 @@ export default defineComponent({
|
||||
}
|
||||
);
|
||||
|
||||
console.log(response.data);
|
||||
|
||||
alert('Zapisano do bazy!');
|
||||
this.loadData();
|
||||
} catch (error) {
|
||||
this.store.alertMessage = 'Ups! Wystąpił błąd podczas zapisywania danych!';
|
||||
this.store.alertMessage = 'Ups! Wystąpił błąd podczas zapisywania danych!';
|
||||
}
|
||||
},
|
||||
|
||||
@@ -162,10 +169,11 @@ export default defineComponent({
|
||||
checkpoints: '',
|
||||
authors: '',
|
||||
availability: 'default',
|
||||
id: `#${Math.random().toString(32).substring(2)}`,
|
||||
};
|
||||
|
||||
this.store.changeList[name] = { ...newSt };
|
||||
this.store.changeBackupList[name] = null;
|
||||
this.store.changeList[newSt.id] = { ...newSt };
|
||||
this.store.changeBackupList[newSt.id] = null;
|
||||
this.store.searchedSceneryName = name;
|
||||
|
||||
this.store.unsavedChanges = true;
|
||||
|
||||
Reference in New Issue
Block a user