mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-25 02:31:59 -05:00
Updated cancelation URL for donations (#17555)
refs https://github.com/TryGhost/Product/issues/3650 - also adds an await on the .json() call
This commit is contained in:
parent
6d85ea4425
commit
4e0f52a7cb
2 changed files with 5 additions and 5 deletions
|
@ -15,7 +15,7 @@ const SupportPage = () => {
|
||||||
const siteUrl = window.location.origin;
|
const siteUrl = window.location.origin;
|
||||||
const currentUrl = siteUrl + window.location.pathname;
|
const currentUrl = siteUrl + window.location.pathname;
|
||||||
const successUrl = `${currentUrl}#/portal/support/success`;
|
const successUrl = `${currentUrl}#/portal/support/success`;
|
||||||
const cancelUrl = `${currentUrl}#/portal/support/error`;
|
const cancelUrl = currentUrl;
|
||||||
const api = setupGhostApi({siteUrl});
|
const api = setupGhostApi({siteUrl});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -424,14 +424,14 @@ function setupGhostApi({siteUrl = window.location.origin, apiUrl, apiKey}) {
|
||||||
body: JSON.stringify(body)
|
body: JSON.stringify(body)
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
const responseJson = await response.json();
|
||||||
const errorData = await response.json();
|
|
||||||
const errorMessage = errorData?.errors?.[0]?.message || 'There was an error processing your payment. Please try again.';
|
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorMessage = responseJson?.errors?.[0]?.message || 'There was an error processing your payment. Please try again.';
|
||||||
throw new Error(errorMessage);
|
throw new Error(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.json();
|
return responseJson;
|
||||||
},
|
},
|
||||||
|
|
||||||
async editBilling({successUrl, cancelUrl, subscriptionId} = {}) {
|
async editBilling({successUrl, cancelUrl, subscriptionId} = {}) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue