You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
699 B

3 years ago
  1. export default {
  2. SET_TOKEN(state, token) {
  3. state.token = token
  4. uni.setStorageSync('token', token)
  5. },
  6. REMOVE_TOKEN(state) {
  7. state.token = null
  8. uni.removeStorageSync('token')
  9. },
  10. SET_USER_INFO(state, userInfo) {
  11. state.userInfo = userInfo
  12. uni.setStorageSync('userInfo')
  13. },
  14. REMOVE_USER_INFO(state) {
  15. state.userInfo = null
  16. uni.removeStorageSync('userInfo')
  17. },
  18. SET_CONFIG(state, config) {
  19. state.config = config
  20. uni.setStorageSync('config')
  21. },
  22. GET_CONFIG(state) {
  23. state.config = null
  24. uni.removeStorageSync('config')
  25. },
  26. LOGOUT() {
  27. this.commit('REMOVE_TOKEN')
  28. this.commit('REMOVE_USER_INFO')
  29. }
  30. }