bootstrap.js 437 B

12345678910111213
  1. import store from '@/store'
  2. import storage from '@/utils/storage'
  3. import { getPlatform } from '@/utils/app'
  4. import { ACCESS_TOKEN, USER_ID } from '@/store/mutation-types'
  5. export default function Initializer() {
  6. // 当前运行的终端
  7. store.commit('SET_PLATFORM', getPlatform())
  8. // 用户认证token
  9. store.commit('SET_TOKEN', storage.get(ACCESS_TOKEN))
  10. // 当前用户ID
  11. store.commit('SET_USER_ID', storage.get(USER_ID))
  12. }