better async handling for flag unflag
This commit is contained in:
parent
640085c049
commit
c12f72e3fe
File diff suppressed because one or more lines are too long
|
@ -224,6 +224,7 @@ export default {
|
||||||
},
|
},
|
||||||
flag({ dispatch, commit, state }, args) {
|
flag({ dispatch, commit, state }, args) {
|
||||||
console.log("user flag", args.uuid, args.collid);
|
console.log("user flag", args.uuid, args.collid);
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
const params = {
|
const params = {
|
||||||
flagid: state.flagcolls[args.collid].flag_id,
|
flagid: state.flagcolls[args.collid].flag_id,
|
||||||
uuid: args.uuid,
|
uuid: args.uuid,
|
||||||
|
@ -232,15 +233,19 @@ export default {
|
||||||
return MA.post(`materio_flag/flag`, params)
|
return MA.post(`materio_flag/flag`, params)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
console.log("user MA flag", data);
|
console.log("user MA flag", data);
|
||||||
dispatch('getUserFlagColls')
|
dispatch('getUserFlagColls').then(() =>{
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn("Issue USER MA flag", error);
|
console.warn("Issue USER MA flag", error);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
unFlag({ dispatch, commit, state }, args) {
|
unFlag({ dispatch, commit, state }, args) {
|
||||||
console.log("user unFlag", args.uuid, args.collid);
|
console.log("user unFlag", args.uuid, args.collid);
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
const params = {
|
const params = {
|
||||||
flagid: state.flagcolls[args.collid].flag_id,
|
flagid: state.flagcolls[args.collid].flag_id,
|
||||||
uuid: args.uuid,
|
uuid: args.uuid,
|
||||||
|
@ -249,12 +254,14 @@ export default {
|
||||||
return MA.post(`materio_flag/unflag`, params)
|
return MA.post(`materio_flag/unflag`, params)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
console.log("user MA unFlag", data);
|
console.log("user MA unFlag", data);
|
||||||
dispatch('getUserFlagColls')
|
dispatch('getUserFlagColls').then(() =>{
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn("Issue USER MA unFlag", error);
|
console.warn("Issue USER MA unFlag", error);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
userLogout({ commit, state }) {
|
userLogout({ commit, state }) {
|
||||||
const credentials = qs.stringify({
|
const credentials = qs.stringify({
|
||||||
|
|
Loading…
Reference in New Issue