From 1298267799216676827ef227e7c9542f1d2ee6dd Mon Sep 17 00:00:00 2001 From: gdbroman <99gustaf@gmail.com> Date: Mon, 6 Nov 2023 16:25:57 +0000 Subject: [PATCH] Fix custom domain error handling --- .../src/pages/account/custom-domain.tsx | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/hosting-holium-com/src/pages/account/custom-domain.tsx b/hosting-holium-com/src/pages/account/custom-domain.tsx index 2919def04..458e8822c 100644 --- a/hosting-holium-com/src/pages/account/custom-domain.tsx +++ b/hosting-holium-com/src/pages/account/custom-domain.tsx @@ -35,25 +35,23 @@ const CustomDomainPresenter = () => { setErrorMessage(undefined); setSuccessMessage(undefined); - const result = await thirdEarthApi.setCustomDomain( - token, - domain, - ship.droplet_id.toString(), - ship.droplet_ip, - ship.id.toString(), - ship.user_id.toString() - ); - - if (result) { - if (result.checkIp !== ship.droplet_id.toString()) { - setErrorMessage( - `The domain you entered does not point to the correct IP address (${ship.droplet_ip}).` - ); - } else { - setSuccessMessage( - `Your domain has been set to ${domain}. It may take a few minutes to propagate.` - ); - } + try { + await thirdEarthApi.setCustomDomain( + token, + domain, + ship.droplet_id.toString(), + ship.droplet_ip, + ship.id.toString(), + ship.user_id.toString() + ); + setSuccessMessage( + `Your domain has been set to ${domain}. It may take a few minutes to propagate.` + ); + } catch (error) { + console.error(error); + setErrorMessage( + `The domain you entered does not point to the correct IP address (${ship.droplet_ip}).` + ); } submitting.toggleOff();