import { getTiktokSellerInfo } from '@/api/tiktok/seller/get';
import { TiktokShopIdentify } from '@background/store/shop';

export const tiktokShopIdentify = async () => {
  const shopInfo = await getTiktokSellerInfo();

  if (!shopInfo || !shopInfo.seller) {
    return null;
  }

  if (!shopInfo.seller.seller_id || !shopInfo.seller.shop_name) {
    return null;
  }

  TiktokShopIdentify.setShopId(shopInfo.seller.seller_id);
  TiktokShopIdentify.setShopName(shopInfo.seller.shop_name);

  return shopInfo;
};
