From 9d3d73b9563ce8c30ba94450eaa1c50daf99ed85 Mon Sep 17 00:00:00 2001 From: Dmitry S Date: Sun, 24 Sep 2023 23:19:51 +0200 Subject: [PATCH 1/2] Fix safari tab icon color --- ui-dashboard/index.html | 3 +-- ui-payment/index.html | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ui-dashboard/index.html b/ui-dashboard/index.html index 5fa65d8..c3d8054 100644 --- a/ui-dashboard/index.html +++ b/ui-dashboard/index.html @@ -7,8 +7,7 @@ - - + O2Pay diff --git a/ui-payment/index.html b/ui-payment/index.html index 81f1fa2..49da74a 100644 --- a/ui-payment/index.html +++ b/ui-payment/index.html @@ -7,8 +7,7 @@ - - + OxygenPay From 973b8e94a41eae72279d59180201ded95dd1687a Mon Sep 17 00:00:00 2001 From: Dmitry S Date: Wed, 27 Sep 2023 23:40:40 +0200 Subject: [PATCH 2/2] Fix merchant pages when there are 0 items --- ui-dashboard/src/app.tsx | 10 +++------- ui-dashboard/src/hooks/use-merchant-id.ts | 2 ++ .../manage-merchants-page/manage-merchants-page.tsx | 5 +---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/ui-dashboard/src/app.tsx b/ui-dashboard/src/app.tsx index 56d56c8..6bb4079 100644 --- a/ui-dashboard/src/app.tsx +++ b/ui-dashboard/src/app.tsx @@ -156,20 +156,16 @@ const App: React.FC = () => { }; const listMerchant = async () => { - if (!user) { - return; + if (user && newMerchantId) { + await getMerchant(newMerchantId); } - - if (!newMerchantId) return; - - await getMerchant(newMerchantId); - setIsLoading(false); }; await getCookie(); await getMe(); await listMerchants(); await listMerchant(); + setIsLoading(false); }; useMount(async () => { diff --git a/ui-dashboard/src/hooks/use-merchant-id.ts b/ui-dashboard/src/hooks/use-merchant-id.ts index f04d316..46b7ad9 100644 --- a/ui-dashboard/src/hooks/use-merchant-id.ts +++ b/ui-dashboard/src/hooks/use-merchant-id.ts @@ -14,6 +14,8 @@ const useMerchantId = (): MerchantIdState => { setMerchantId(merchantId); if (merchantId) { localStorage.set("merchantId", merchantId); + } else { + localStorage.remove("merchantId"); } }; diff --git a/ui-dashboard/src/pages/manage-merchants-page/manage-merchants-page.tsx b/ui-dashboard/src/pages/manage-merchants-page/manage-merchants-page.tsx index d5dc04e..8527289 100644 --- a/ui-dashboard/src/pages/manage-merchants-page/manage-merchants-page.tsx +++ b/ui-dashboard/src/pages/manage-merchants-page/manage-merchants-page.tsx @@ -85,10 +85,7 @@ const ManageMerchantsPage: React.FC = () => { await getMerchants(); const nextMerchant = merchants?.find((merchantItem) => merchantItem.id !== merchant.id); - - if (nextMerchant) { - setMerchantId(nextMerchant.id); - } + setMerchantId(nextMerchant ? nextMerchant.id : null); openNotification(`Merchant ${merchant.name} has been deleted`, "Thank you for being with us"); } catch (error) {