In vue, how do I trigger data modification of a vue component in an external js?

I encapsulate all interface requests under model/api.js and make axios requests in api.js. One of the error codes in the return of the request is that it is not logged in. I need to log in in a pop-up window in this case.
excuse me, how can I realize this pop-up window?

if the pop-up window is written in main.vue, then I need to modify main.vue "s data
or this data is vuex"s store, in api.js, then I need to modify store
in api.js. Is there any good way or example? Thank you, the boss of sf

.
Mar.01,2021

import store from '../store/store'
import axios from 'axios'
import {SET_TOAST_INFO, SET_LOADING_STATE} from '../store/type'



axios.interceptors.request.use(config => {
    return config
}, error => {
    store.commit(SET_TOAST_INFO, {
        mode: 'danger',
        title: ''
    });

    return Promise.reject(error)
})
// http
axios.interceptors.response.use(data => {
    return data.data;

}, error => {
    if (error.response) {
        store.commit(SET_LOADING_STATE,  false);
        switch (error.response.status) {
            case 401:
                store.commit(SET_TOAST_INFO, {
                    mode: 'danger',
                    title: ''
                });
                window.location.href = '/-sharp/login';
                break;
            default:
                store.commit(SET_TOAST_INFO, {
                    mode: 'danger',
                    title: ''
                });
                break;

        }
    }
})

under what circumstances does the unlogged error code of your callback occur? Token failure or something?

Menu