<script>
	import {
		request
	} from 'common/request.js'
	export default {
		onLaunch: async function() {
			const token = uni.getStorageSync("token");
			if (!token) {
				uni.redirectTo({
					url: "/pages/my/login",
				})
			} else {
				request({
					url: "/api/daily/user/refresh_token"
				}).then(res => {
					uni.setStorageSync("token", res.token)
				}).catch(e => {
					uni.redirectTo({
						url: "/pages/my/login",
					})
				})
			}
		},
		onShow: function() {},
		onLoad: function() {
			wx.setEnableDebug(({
				enableDebug: false
			}))
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
	page {
		height: 100vh;
	}
</style>
