mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 23:53:50 +00:00
Update version within PUT request
Try to add api logic check for version being the same instead of smaller implementing optimistic locking and displaying correct message in frontend rector fixes adjust violation message and add translation in translation.yaml add translator in apiController
This commit is contained in:
@@ -599,7 +599,7 @@ export default {
|
||||
},
|
||||
submit() {
|
||||
this.$store.dispatch('submit').catch((error) => {
|
||||
if (error.name === 'ValidationException' || error.name === 'AccessException') {
|
||||
if (error.name === 'ValidationException' || error.name === 'AccessException' || error.name === 'ConflictHttpException') {
|
||||
error.violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'});
|
||||
|
@@ -75,6 +75,7 @@ const store = createStore({
|
||||
return {
|
||||
type: 'accompanying_period_work',
|
||||
id: state.work.id,
|
||||
version: state.version,
|
||||
startDate: state.startDate === null || state.startDate === '' ? null : {
|
||||
datetime: datetimeToISO(ISOToDate(state.startDate))
|
||||
},
|
||||
@@ -505,19 +506,22 @@ const store = createStore({
|
||||
url = `/api/1.0/person/accompanying-course/work/${state.work.id}.json`,
|
||||
errors = []
|
||||
;
|
||||
|
||||
commit('setIsPosting', true);
|
||||
|
||||
console.log('the social action', payload);
|
||||
// console.log('the social action', payload);
|
||||
|
||||
return makeFetch('PUT', url, payload)
|
||||
.then(data => {
|
||||
if (typeof(callback) !== 'undefined') {
|
||||
return callback(data);
|
||||
} else {
|
||||
console.info('nothing to do here, bye bye');
|
||||
// console.log('payload', payload.privateComment)
|
||||
// console.info('nothing to do here, bye bye');
|
||||
window.location.assign(`/fr/person/accompanying-period/${state.work.accompanyingPeriod.id}/work`);
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log('error', error)
|
||||
commit('setIsPosting', false);
|
||||
throw error;
|
||||
});
|
||||
|
Reference in New Issue
Block a user