const auth = require('./utils/auth') const { BRAND_CONFIG } = require('./utils/config') App({ globalData: { appName: BRAND_CONFIG.appName, shopName: BRAND_CONFIG.defaultShopName, userInfo: null, planningNeedRefresh: false }, onLaunch() { this.bootstrapSession() }, bootstrapSession() { const session = auth.getSession() this.globalData.userInfo = session.userInfo || null if (session.shopName) { this.globalData.shopName = session.shopName } }, setSession(session) { auth.setSession(session) this.bootstrapSession() }, clearSession() { auth.clearSession() this.globalData.userInfo = null } })