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