From a0583f05ed1f28fb83a60030907a98ccabe38faa Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 23 Mar 2025 13:54:40 -0600 Subject: [PATCH] feat: improve LicenseSuccess page with enhanced error handling and updated license details display --- .../app/[locale]/license/success/page.tsx | 87 +++++++++++++------ 1 file changed, 59 insertions(+), 28 deletions(-) diff --git a/apps/website/app/[locale]/license/success/page.tsx b/apps/website/app/[locale]/license/success/page.tsx index 15ca90c..02ab589 100644 --- a/apps/website/app/[locale]/license/success/page.tsx +++ b/apps/website/app/[locale]/license/success/page.tsx @@ -40,7 +40,7 @@ export default function LicenseSuccess() { useEffect(() => { setLoading(true); - console.log(`${SERVER_LICENSE_URL}/license/session?sessionId=${sessionId}`); + fetch(`${SERVER_LICENSE_URL}/license/session?sessionId=${sessionId}`, { method: "GET", headers: { @@ -48,10 +48,15 @@ export default function LicenseSuccess() { }, }) .then((res) => res.json()) - .then((data) => setData(data)) + .then((data) => { + if (data.error) { + setError(data.error); + } else { + setData(data); + } + }) .catch((err) => { - console.error(err); - setError(err.message); + setError(err); }) .finally(() => { setLoading(false); @@ -75,6 +80,8 @@ export default function LicenseSuccess() { toast.success("Copied to clipboard"); }; + console.log(error); + return (
@@ -171,9 +178,9 @@ export default function LicenseSuccess() {

Steps to enable paid features

-
-
- - {data?.key} - - + +
+ License Details: + + License Type:{" "} + {data?.type === "basic" + ? "Basic" + : data?.type === "professional" + ? "Professional" + : "Business"} + + + + Billing Type:{" "} + {data?.billingType === "monthly" ? "Monthly" : "Yearly"} + + + License Key: +
+ + {data?.key} + + +