import Seo from '@/core/components/Seo';
import BasicLayout from '@/core/components/layouts/BasicLayout';
import CreateMerchant from '@/lib/merchant/components/Merchant';
import ErrorMerchant from '@/lib/merchant/components/AccountSwitch';
import useAuth from '@/core/hooks/useAuth';
import { useRouter } from 'next/router';
export default function DaftarMerchant() {
  const router = useRouter();
  const auth = useAuth();
  if (auth == false) {
    router.push(`/login?next=${encodeURIComponent('/daftar-merchant')}`);
  }
  if (!auth) {
    return;
  }
  return (
    <>
      <Seo title='Daftar Merchant - Indoteknik.com' />

      <BasicLayout>
        {auth && auth?.company ? (
          <CreateMerchant></CreateMerchant>
        ) : (
          <ErrorMerchant />
        )}
      </BasicLayout>
    </>
  );
}
