Answer the question
In order to leave comments, you need to log in
How to properly implement a double request?
methods: {
signin() {
// this.$root.$emit('loading', true);
axios.all([
axios.post('auth/signin', {
user: {
email: this.email,
password: this.password,
}
}),
axios.get("captcha/check", {
captcha: this.captcha
})
]).then(res => {
console.log(res.data.user);
if (res.data.success === true) {
this.$root.$emit('loading', true);
return this.$store.dispatch('user/auth', res.data);
Answer the question
In order to leave comments, you need to log in
function getUserAccount() {
return axios.get('/user/12345');
}
function getUserPermissions() {
return axios.get('/user/12345/permissions');
}
axios.all([getUserAccount(), getUserPermissions()])
.then(axios.spread(function (acct, perms) {
// Both requests are now complete
}));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question