From b71ebbeec8430327a5f2056332c6f237b6032ef2 Mon Sep 17 00:00:00 2001 From: Matthew Foster Date: Fri, 1 Dec 2023 15:40:45 -0800 Subject: [PATCH] clean up logic --- src/components/Tabs/IdentificationTab.jsx | 24 +++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/components/Tabs/IdentificationTab.jsx b/src/components/Tabs/IdentificationTab.jsx index 6e1617a5..8da6523b 100644 --- a/src/components/Tabs/IdentificationTab.jsx +++ b/src/components/Tabs/IdentificationTab.jsx @@ -216,21 +216,19 @@ const IdentificationTab = ({ updateRecord("doiCreationStatus")('') } else if (debouncedDoiIdValue) { - const doiUrl = debouncedDoiIdValue - if (doiUrl) { - let id = doiUrl - if (doiUrl.includes('doi.org/')) { - id = doiUrl.split('doi.org/').pop(); - } - getDoiStatus({ doi: id, prefix: regionInfo.datacitePrefix }) - .then(response => { - updateRecord("doiCreationStatus")(response.data) - }) - .catch(err => { - console.error(err) - }); + let id = debouncedDoiIdValue + if (debouncedDoiIdValue.includes('doi.org/')) { + id = debouncedDoiIdValue.split('doi.org/').pop(); } + getDoiStatus({ doi: id, prefix: regionInfo.datacitePrefix }) + .then(response => { + updateRecord("doiCreationStatus")(response.data) + }) + .catch(err => { + console.error(err) + }); } + return () => { mounted.current = false; };