<script>
import { mapActions } from 'vuex';

export default {
  async onLaunch() {
    uni.getSetting({
      success(res) {
        if (!res.authSetting['scope.userLocation']) {
          uni.authorize({
            scope: 'scope.userLocation',
            success() {},
          });
        }
      },
    });

    await this.login();
    this.getSites();
  },

  methods: {
    ...mapActions('user', ['login']),
    ...mapActions('site', ['getSites']),
  },
};
</script>

<style lang="scss">
@import 'colorui/main.scss';
@import 'colorui/icon.scss';
@import 'colorui/animation.scss';
@import 'common/style/global';
@import 'common/style/iconfont';
</style>
