Answer the question
In order to leave comments, you need to log in
What type does the method return?
I tried instead of : Promise any - : AxiosPromise, it doesn't work, tell me what type to specify, so that there is no any
logout({commit, dispatch}): Promise<any> {
commit('loadingStateChanged', true);
return axios.get('/logout')
.then(() => {
commit('loadingStateChanged', false);
commit('user/userLoaded', undefined, {root: true});
dispatch('clearAuthData');
router.push({name: 'login'});
})
.catch((error: AxiosError) => {
commit('loadingStateChanged', false);
const message: string = error.response ? error.response.data.detail : error.message;
throw new Error(message);
});
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question