nuxtjs

Redirect authenticated users nuxt js

孤者浪人 提交于 2021-01-29 18:25:40
问题 I have the following code from my state to handle the login request and load the incoming data to state. export const state = { userId: "", token: "", authenticated: false }; export const getters = {}; export const actions = { async login({ commit, dispatch }, formData) { //codes to get data from server goes here // incoming datas are {status: true,token: 'token123', userId: '123'} const remainingMilliseconds = 60 * 60 * 1000; const expiryDate = new Date(new Date().getTime() +