<template>
  <layout>
    <div
      class="container d-flex justify-content-center flex-row h-100 px-sm-d-0"
      :class="{ 'align-self-center': isLoading('loadingSubscription') }"
    >
      <icon v-if="isLoading('loadingSubscription')" name="spinner" class="icon-size-4 " pulse />
      <router-view v-else />
    </div>
  </layout>
</template>
<script>
import layout from './templates/Layout'
import { setDefaultToken } from '@/store/utils/api'
import Routes from '../router'
import { mapActions, mapGetters } from 'vuex'

export default {
  name: 'Order',
  mixins: [],
  components: { layout },
  data() {
    return {
      nextLink: Routes[0].children[0].path,
    }
  },
  mounted() {
    let self = this
    this.loadSubscriptionSale().then(() => {
      self.$router.replace(self.nextLink)
    })
  },
  methods: {
    ...mapActions(['loadSubscriptionSale']),
  },
  computed: {
    ...mapGetters(['isLoading']),
  },
}
</script>
