import { getTplList } from '@/api/rental' import { authDB } from '@/db' const state = { comment: {}, province: {} } const mutations = { SET_PROVINCE: (state, province) => { authDB.set('province', province) state.province = province }, SET_COMMENT: (state, comment) => { authDB.set('comment', comment) state.comment = comment }, SET_WEBSITE: (state, website) => { authDB.set('website', website) state.website = website } } const actions = { // get user info getTplList({ commit, state }) { return new Promise((resolve, reject) => { getTplList().then(response => { if (!response) { reject('Verification failed, please Login again.') } console.log("getTplList", response) const { province, comment, website } = response; commit('SET_PROVINCE', province) commit('SET_COMMENT', comment) commit('SET_WEBSITE', website) // commit('SET_ROLES', roles) // commit('SET_AVATAR', avatar) // commit('SET_INTRODUCTION', introduction) resolve(response) }).catch(error => { reject(error) }) }) } } export default { namespaced: true, state, mutations, actions }