work_order/store/modules/app.js

28 lines
664 B
JavaScript
Raw Normal View History

2024-01-11 19:12:26 +08:00
const state = {
userInfo: JSON.parse(uni.getStorageSync('user_info') || '{}') || {},
token: uni.getStorageSync('token') || ''
};
const mutations = {
SET_USERINFO(state, data) {
state.userInfo = data;
uni.setStorageSync('user_info', JSON.stringify(data));
},
LOGOUT(state) {
state.userInfo = {};
state.token = '';
uni.removeStorageSync('user_info');
uni.removeStorageSync('token');
2024-01-12 15:13:29 +08:00
uni.removeStorageSync('query');
2024-01-11 19:12:26 +08:00
},
SET_TOKEN(state, data) {
state.token = data.token;
uni.setStorageSync('token', data.token);
uni.setStorageSync('token_time', data.token_time);
},
};
export default {
state,
mutations,
};