From 6319e23dae2127d62bc72fd65ea5a7e148960b6d Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Mon, 11 Jul 2022 15:49:01 +0300 Subject: [PATCH] fix: update lightning address validation handle 404 responses in lightning addresses validation closes issue #70 --- .../pages/ProfilePage/AboutCard/UpdateAboutForm.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/features/Profiles/pages/ProfilePage/AboutCard/UpdateAboutForm.tsx b/src/features/Profiles/pages/ProfilePage/AboutCard/UpdateAboutForm.tsx index 4f06cb1..17a2b8d 100644 --- a/src/features/Profiles/pages/ProfilePage/AboutCard/UpdateAboutForm.tsx +++ b/src/features/Profiles/pages/ProfilePage/AboutCard/UpdateAboutForm.tsx @@ -30,9 +30,10 @@ const schema: yup.SchemaOf = yup.object({ if (value) { const [name, domain] = value.split("@"); const lnurl = `https://${domain}/.well-known/lnurlp/${name}`; - await fetch(lnurl); + const res = await fetch(lnurl); + if (res.status === 200) return true; } - return true; + return false; } catch (error) { return false; } @@ -141,7 +142,7 @@ export default function UpdateAboutForm({ data, onClose }: Props) { type='text' className="input-text" - placeholder="UK, London" + placeholder="Back-end Developer" {...register("jobTitle")} />