The problem of value modification of vuex

my project uses vuex and router, and then my store is written directly in main.js, as follows

const store = new Vuex.Store({
  state: {
    urlex:"http://pj.dianmila.com/supersolid/images/",
    issign: 0,
    icon:"",
    name:""
  },
  mutations: {
    login(state,next){
    axios.post("url")
    .then(function (res) {
                var datajson = res.data;
                state.issign = datajson.state;
                state.icon=datajson.img;
                state.name=datajson.nickname;
                if(datajson.state == 1) {
                    axios.post("url")
                    .then(function (res) {
                                    var datajson = res.data
                                    var mylist = datajson.list[0]
                                    state.name=mylist.name
                                    next()
                            })
                    .catch(function (error) {
                    window.location.href = "url"
                    });
                }
                else next();
            })
    .catch(function (error) {
    window.location.href = "url"
    });
    }
  }
})

then defines a navigation guard

router.beforeEach((to, from, next) => {
    window.document.title = "";
  store.commit("login",next)
})

then found that after running, the values of the state of those store did not change. Why, the code did not report an error, that is, the value of store could not change

.

problem description

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

topic description

sources of topics and their own ideas

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

May.22,2021

take a look at the break point

Menu