A
A
asd dsa2019-02-02 12:57:35
typescript
asd dsa, 2019-02-02 12:57:35

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

1 answer(s)
A
Alex, 2019-02-02
@yaNastia

AxiosPromise<void>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question