mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
url's and method changed for toggleIntensity and toggleConfidential
This commit is contained in:
parent
a399804094
commit
ee817b1d62
@ -76,19 +76,19 @@ export default {
|
||||
},
|
||||
toggleConfidential() {
|
||||
this.$store.dispatch('fetchPermissions').then(() => {
|
||||
if (!this.$store.getters.canTogglePermission) {
|
||||
this.$toast.open({message: "Seul le référent peut modifier la confidentialité"});
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
return this.$store.dispatch('toggleConfidential', (!this.isConfidential));
|
||||
}
|
||||
}).catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
if (!this.$store.getters.canTogglePermission) {
|
||||
this.$toast.open({message: "Seul le référent peut modifier la confidentialité"});
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
return this.$store.dispatch('toggleConfidential', (!this.isConfidential));
|
||||
}
|
||||
}).catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -420,13 +420,13 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
||||
const url = `/api/1.0/person/accompanying-course/resource/${id}.json`;
|
||||
|
||||
return makeFetch('PATCH', url, body)
|
||||
.then((response) => {
|
||||
commit('patchResource', response);
|
||||
})
|
||||
.catch((error) => {
|
||||
commit('catchError', error);
|
||||
throw error;
|
||||
})
|
||||
.then((response) => {
|
||||
commit('patchResource', response);
|
||||
})
|
||||
.catch((error) => {
|
||||
commit('catchError', error);
|
||||
throw error;
|
||||
})
|
||||
},
|
||||
/**
|
||||
* On The Fly
|
||||
@ -468,12 +468,12 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
||||
* Update accompanying course intensity/emergency/confidentiality
|
||||
*/
|
||||
toggleIntensity({ commit }, payload) {
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`
|
||||
const url = `/api/1.0/person/accompanying-course/${id}/intensity.json`
|
||||
const body = { type: "accompanying_period", 'intensity': payload }
|
||||
|
||||
return makeFetch('PATCH', url, body)
|
||||
return makeFetch('POST', url, body)
|
||||
.then((response) => {
|
||||
commit('toggleIntensity', response.intensity);
|
||||
commit('toggleIntensity', response);
|
||||
|
||||
})
|
||||
.catch((error) => {
|
||||
@ -495,12 +495,15 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
||||
})
|
||||
},
|
||||
toggleConfidential({ commit }, payload) {
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`
|
||||
const url = `/api/1.0/person/accompanying-course/${id}/confidential.json`
|
||||
const body = { type: "accompanying_period", confidential: payload }
|
||||
|
||||
return makeFetch('PATCH', url, body)
|
||||
console.log('url', url)
|
||||
console.log('body', body)
|
||||
|
||||
return makeFetch('POST', url, body)
|
||||
.then((response) => {
|
||||
commit('toggleConfidential', response.confidential);
|
||||
commit('toggleConfidential', response);
|
||||
})
|
||||
.catch((error) => {
|
||||
commit('catchError', error);
|
||||
|
Loading…
x
Reference in New Issue
Block a user