import { removeUserInfo, removeToken } from '../../utils/storage'
import EventEmitter from '../../utils/eventEmitter'
const app = getApp()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    userinfo: app.globalData.userinfo
  },

  onLoad () {
    this.setData({
      userinfo: app.globalData.userinfo
    })
  },
  logout () {
    removeUserInfo()
    removeToken()
    app.globalData.token = ''
    app.globalData.userinfo = {}
    EventEmitter.emit('logout')
    wx.navigateBack()
  }
})