mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
activity: fix the on-the-fly POSTing of the location entity
This commit is contained in:
@@ -28,7 +28,6 @@ const store = createStore({
|
||||
},
|
||||
getters: {
|
||||
suggestedEntities(state) {
|
||||
console.log(state.activity);
|
||||
if (typeof state.activity.accompanyingPeriod === "undefined") {
|
||||
return [];
|
||||
}
|
||||
@@ -304,14 +303,28 @@ const store = createStore({
|
||||
let hiddenLocation = document.getElementById(
|
||||
"chill_activitybundle_activity_location"
|
||||
);
|
||||
//TODO post the location if new location on-the-fly
|
||||
if (value.onthefly) {
|
||||
postLocation(value)
|
||||
const body = {
|
||||
"type": "location",
|
||||
"name": value.name === '__AccompanyingCourseLocation__' ? null : value.name,
|
||||
"locationType": {
|
||||
"id": value.locationType.id,
|
||||
"type": "location-type"
|
||||
}
|
||||
};
|
||||
if (value.address.id) {
|
||||
Object.assign(body, {
|
||||
"address": {
|
||||
"id": value.address.id
|
||||
},
|
||||
})
|
||||
}
|
||||
postLocation(body)
|
||||
.then(
|
||||
location => hiddenLocation.value = location.id
|
||||
).catch(
|
||||
err => {
|
||||
this.errors.push(err.message);
|
||||
console.log(err.message);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user