Here is the code snippet I am working with:
signin(context, payload, resolve) {
console.log("Processing SIGNIN action")
const userEmail = payload.locmail
const userPassword = payload.locpass
backend.get("api/auth/signin", {
headers: {
'planck': 'FRESH'
},
crossDomain: true,
params: {
password: userPassword,
email: userEmail
}
}).then(function(response) {
console.log("Request SENT")
if (response.data.auth === 'TRUE') {
context.commit('authenticate', response.data.planck)
state.isAuthenticated = true
} else {
state.isAuthenticated = false
}
console.log(response)
return Promise.resolve(response)
});
}
When calling this from a component:
this.$store.dispatch('signin', {
locmail,
locpass
}).then(response => {
console.log(response);
});
The issue arises when the console log prints undefined
. Can someone please help me in identifying what might be wrong here? The documentation suggests using resolve()
, but doing so results in an error saying that it's not a function.