mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
update job if users assigns him/herself as referrer and job is not null
This commit is contained in:
parent
a3c3834081
commit
6567143ff5
@ -253,7 +253,6 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
||||
state.accompanyingCourse.administrativeLocation = value;
|
||||
},
|
||||
updateReferrer(state, value) {
|
||||
//console.log('value', value);
|
||||
state.accompanyingCourse.user = value;
|
||||
},
|
||||
updateJob(state, value) {
|
||||
@ -775,9 +774,7 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
||||
throw error;
|
||||
})
|
||||
},
|
||||
updateReferrer({ commit }, payload) {
|
||||
console.log('update referrer', payload);
|
||||
console.log('payload !== null', payload !== null);
|
||||
updateReferrer({ commit, state }, payload) {
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
||||
let body = { type: "accompanying_period", user: null };
|
||||
|
||||
@ -788,7 +785,10 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
||||
return makeFetch('PATCH', url, body)
|
||||
.then((response) => {
|
||||
commit('updateReferrer', response.user);
|
||||
commit('setFilteredReferrersSuggested');
|
||||
if (null !== payload.user_job && payload.user_job !== state.accompanyingCourse.job) {
|
||||
this.dispatch('updateJob', payload.user_job);
|
||||
}
|
||||
// commit('setFilteredReferrersSuggested'); // this mutation doesn't exist?
|
||||
})
|
||||
.catch((error) => {
|
||||
commit('catchError', error);
|
||||
@ -799,6 +799,8 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
||||
let body = { type: "accompanying_period", job: null };
|
||||
|
||||
console.log('update job', payload);
|
||||
|
||||
if (payload !== null) {
|
||||
body = { type: "accompanying_period", job: { id: payload.id, type: payload.type } };
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user