diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-05-26 16:20:09 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-05-26 16:20:09 +0700 |
| commit | 3d91a6e1ac168d0749cd816c1ea99b44336ffa0c (patch) | |
| tree | f09393c5f2c2c5f36b75db6764c4f5aa04086e0b /src | |
| parent | 7bceb663cfdaf268082555501d627acd9ade3429 (diff) | |
<fix merchant>
Diffstat (limited to 'src')
| -rw-r--r-- | src/pages/daftar-merchant.jsx | 15 | ||||
| -rw-r--r-- | src/pages/daftar-merchant/[status].jsx | 47 | ||||
| -rw-r--r-- | src/pages/daftar-merchant/index.jsx | 53 |
3 files changed, 15 insertions, 100 deletions
diff --git a/src/pages/daftar-merchant.jsx b/src/pages/daftar-merchant.jsx new file mode 100644 index 00000000..945a0060 --- /dev/null +++ b/src/pages/daftar-merchant.jsx @@ -0,0 +1,15 @@ +import Seo from '@/core/components/Seo' +import BasicLayout from '@/core/components/layouts/BasicLayout' +import CreateMerchant from '@/lib/form/components/Merchant' + +export default function DaftarMerchant() { + return ( + <> + <Seo title='Daftar Merchant - Indoteknik.com' /> + + <BasicLayout> + <CreateMerchant></CreateMerchant> + </BasicLayout> + </> + ) +}
\ No newline at end of file diff --git a/src/pages/daftar-merchant/[status].jsx b/src/pages/daftar-merchant/[status].jsx deleted file mode 100644 index 61c07571..00000000 --- a/src/pages/daftar-merchant/[status].jsx +++ /dev/null @@ -1,47 +0,0 @@ -import BasicLayout from '@/core/components/layouts/BasicLayout'; -import IsAuth from '@/lib/auth/components/IsAuth'; -import StatusMerchant from '@/lib/merchant/components/AccountSwitch'; -import { useRouter } from 'next/router'; -import axios from 'axios'; -import { useState, useEffect } from 'react'; -import Seo from '@/core/components/Seo'; -import { getAuth } from '~/libs/auth'; - -export async function getServerSideProps(context) { - const { status } = context.query; - // await axios.post( - // `${process.env.NEXT_PUBLIC_SELF_HOST}/api/pengajuan-tempo/${status}`, - // {}, - // { headers: context.req.headers } - // ); - return { props: {} }; -} - -export default function Finish() { - const [isLoading, setIsLoading] = useState(true); - const router = useRouter(); - const auth = getAuth(); - useEffect(() => { - if (!auth) { - const nextUrl = encodeURIComponent(router.asPath); - router.push(`/login?next=${nextUrl}`); - } else { - setIsLoading(false); - } - }, [auth]); - - if (isLoading || !auth) { - return null; // Tidak render apa pun selama loading atau auth/tempo belum tersedia - } - return ( - <> - <Seo title='Pengajuan Tempo Indoteknik.com' /> - - <IsAuth> - <BasicLayout> - <StatusMerchant query={router.query || {}} /> - </BasicLayout> - </IsAuth> - </> - ); -} diff --git a/src/pages/daftar-merchant/index.jsx b/src/pages/daftar-merchant/index.jsx deleted file mode 100644 index 36fedafc..00000000 --- a/src/pages/daftar-merchant/index.jsx +++ /dev/null @@ -1,53 +0,0 @@ -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 getMerchantProgresApi from '@/lib/merchant/api/getMerchantProgresApi'; -import useAuth from '@/core/hooks/useAuth'; -import { useRouter } from 'next/router'; -import React, { useEffect, useState } from 'react'; -export default function DaftarMerchant() { - const router = useRouter(); - const auth = useAuth(); - const [isLoading, setIsLoading] = useState(true); - useEffect(() => { - const loadData = async () => { - setIsLoading(true); - try { - const data = await getMerchantProgresApi(); - switch (data) { - case 'draft': - router.push(`/daftar-merchant/review`); - break; - case 'approve': - router.push(`/daftar-merchant/approve`); - break; - case 'reject': - router.push(`/daftar-merchant/reject`); - break; - } - } catch (error) { - console.error('Error loading profile:', error); - handleIsError(true); // Jika ada error, panggil fungsi error handler - } - setIsLoading(false); - }; - - loadData(); - }, []); - if (auth == false) { - router.push(`/login?next=${encodeURIComponent('/daftar-merchant')}`); - } - if (!auth || isLoading) { - return; - } - return ( - <> - <Seo title='Daftar Merchant - Indoteknik.com' /> - - <BasicLayout> - {auth && auth?.company ? <CreateMerchant /> : <ErrorMerchant />} - </BasicLayout> - </> - ); -} |
