Skip to content

Commit 24c7484

Browse files
committed
[MNY-332] Dashboard: Checkout link error message improvements
1 parent ff8f413 commit 24c7484

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

apps/dashboard/src/@/actions/billing.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,18 @@ export async function getChainInfraCheckoutURL(options: {
109109
}
110110

111111
const json = await res.json();
112+
113+
if (
114+
"error" in json &&
115+
"message" in json.error &&
116+
typeof json.error.message === "string"
117+
) {
118+
return {
119+
error: json.error.message,
120+
status: "error",
121+
} as const;
122+
}
123+
112124
if (!json.result) {
113125
return {
114126
error: "An unknown error occurred, please try again later.",

apps/dashboard/src/app/(app)/(stripe)/utils/billing.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ export async function getBillingCheckoutUrl(options: {
7575
}
7676

7777
const json = await res.json();
78+
79+
if (
80+
"error" in json &&
81+
"message" in json.error &&
82+
typeof json.error.message === "string"
83+
) {
84+
return {
85+
error: json.error.message,
86+
status: "error",
87+
} as const;
88+
}
89+
7890
if (!json.result) {
7991
return {
8092
error: "An unknown error occurred, please try again later.",

0 commit comments

Comments
 (0)