Skip to content
This repository was archived by the owner on Nov 17, 2024. It is now read-only.

Not working inside Axios interceptors #2

Description

@acrolink

I gave defined a global action to be taken if the user hits 401 like this:

import axios from 'axios'

Vue.prototype.$axios = axios;

axios.interceptors.response.use(function(response) {
    return response;
}, function(error) {
    if (error.response.status == 401) {
        router.push('/login')
        flash({
            message: 'You must log in',
            variant: 'success'
        });
        return;
    }
    // Do something with response error
    return Promise.reject(error);
});

No flash message displayed at all.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions