<template>
	<view>
    home
	</view>
</template>

<script>
  import { getUserInfoRequest } from '@/api/user'
  import { useUserStore } from '@/stores/user'
  import { mapState, mapActions } from 'pinia'
  import { getCompanyRequest } from '@/api/app'

	export default {
		data() {
			return {

			}
		},
    computed: {
      ...mapState(useUserStore, ['userInfo'])
    },
    async onLoad() {
      uni.setStorageSync('token', '3016|NQth8ud3JRGLDKO3Gsmg7gEgv9yBjowrZNijlBCp975d2a97')
      this.getUserInfo()
    },
		methods: {
      ...mapActions(useUserStore, ['updateUserInfo']),
      async getUserInfo() {
        const { code, data } = await getUserInfoRequest()
        if(code === 0) {
          this.updateUserInfo(data)
          console.log(this.userInfo)
        }
      }
		}
	}
</script>

<style lang="scss">
page {
  background-color: $uni-bg-color-grey;
}
</style>

<style scoped lang="scss">

</style>
