How to use promise in vue?

/ / Log in

      this.$store.dispatch("Login", this.loginForm).then(info => {
          this.loginloading = false;
          return new Promise((resolve, reject) => {
          //token
            GetAssessTokenInfo(name, psd)
              .then(response => {                  
                resolve(response);
              })
              .catch(error => {
                reject(error);
              });
          });
        })
        .catch(() => {
        });
    

I want to send the protocol to obtain token in the callback after a successful login. How to write the correct promise?

Aug.31,2021

store.js

import { login  } from '@/api/user'
 
const user = {
  state: {
    token: ''
  },
  mutations: {
    SET_TOKEN: (state, data) => {
      state.token= data
    }
  },
  actions: {
    Login({ commit }, userInfo) {
      return new Promise((resolve, reject) => {
        login(userInfo)
          .then(response => {
           const data = response.data
           commit('SET_TOKEN', data.token)
            resolve(response )
          })
          .catch(error => {
            reject(error)
          })
      })
    },

    //   token 
    FedLogOut({ commit }) {
      return new Promise(resolve => {
        commit('SET_TOKEN', '')
      
        resolve()
      })
    }
  }
}

export default user

call

 this.$store.dispatch("Login", this.loginForm).then(info => {
  //  
}).catch(err=>{});
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eab5e1-204f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eab5e1-204f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?