<template>
  <div>
    <template v-if="isMobile">
      <login-mobile/>
    </template>
    <template v-else>
      <login/>
    </template>
  </div>
</template>
<script>
  import {Login} from '~components/login'
  import {LoginMobile} from '~components/mobile'
  export default {
    layout (context) {
      return context.store.state.option.isMobile ? 'mobile' : 'isCityFooter'
    },
    created() {
      this.$http.get('/sso/login/page/style', { params: {appId: this.$route.query.appId} })
        .then(response => {
          console.log(response.data)
          this.$store.commit('login/REQUEST_LOGIN_STYLE_SUCCESS', response.data)
        }, err => {
          this.$store.commit('login/REQUEST_LOGIN_STYLE_FAILURE', err)
        })
    },
    // asyncData ({store, route}) {
    //   return Promise.all([
    //     store.dispatch('GetLoginStyle', {appId: route.query.appId})
    //   ])
    // },
    components: {
      Login,
      LoginMobile
    },
    computed: {
      isMobile () {
        return this.$store.state.option.isMobile
      }
    }
  }
</script>
