<template>
  <div>
    <shop-spy
      v-if="false"
      :shop-id="shopId"
    />
    <shop-search
      v-if="shopName"
      :shop-name="shopName"
      :shop-id="shopId"
    />
  </div>
</template>

<script>
import ShopSpy from '@/vue/components/Shopee/Spy/Shop/Index.vue';
import ShopSearch from '@/vue/components/Shopee/Spy/Search/Shop.vue';
import { getShopeeShopId } from '@/api/shopee/client/shop';

export default {
  name: 'ShopeeSpyShop',
  components: {
    'shop-spy': ShopSpy,
    'shop-search': ShopSearch,
  },
  data() {
    return {
      shopId: this.$route.params.id,
      shopName: '',
    };
  },
  methods: {
    async initShop() {
      const shopData = await getShopeeShopId(this.shopId);
      this.shopName = shopData.account.username;
      this.SetAppTitle(shopData.name);
    },
  },
  created() {
    this.initShop();
  },
};
</script>
