I'm currently working on integrating a login solution into my Vue app using the JWT Authentication plugin.
While I have a test solution that is functional, I'm facing an issue in my main branch where the eslint version seems to be causing an error with "Promise executor functions should not be async no-async-promise-executor".
The code within my 'store' and under my actions looks like this:
login({ commit }, credentials){
return new Promise(async (resolve, reject) => {
try {
const { data } = await axios.post(`https://mywebsite.com/wp-json/jwt-auth/v1/token`, credentials)
commit('SET_USER', data)
resolve(data)
}catch(e){
reject(e)
}
})
},
validate({ state }) {
return axios({
url: `https://mywebsite.com/wp-json/jwt-auth/v1/token/validate`,
method: 'post',
headers: {
'Authorization': `Bearer ${state.user.token}`
}
})
},
I'm unsure how to refactor this code to resolve the error. Any suggestions?