mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-27 21:03:29 +03: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
@ -15,7 +15,7 @@ const SupportPage = () => {
|
||||
const siteUrl = window.location.origin;
|
||||
const currentUrl = siteUrl + window.location.pathname;
|
||||
const successUrl = `${currentUrl}#/portal/support/success`;
|
||||
const cancelUrl = `${currentUrl}#/portal/support/error`;
|
||||
const cancelUrl = currentUrl;
|
||||
const api = setupGhostApi({siteUrl});
|
||||
|
||||
try {
|
||||
|
@ -424,14 +424,14 @@ function setupGhostApi({siteUrl = window.location.origin, apiUrl, apiKey}) {
|
||||
body: JSON.stringify(body)
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json();
|
||||
const errorMessage = errorData?.errors?.[0]?.message || 'There was an error processing your payment. Please try again.';
|
||||
const responseJson = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
const errorMessage = responseJson?.errors?.[0]?.message || 'There was an error processing your payment. Please try again.';
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
return responseJson;
|
||||
},
|
||||
|
||||
async editBilling({successUrl, cancelUrl, subscriptionId} = {}) {
|
||||
|
Loading…
Reference in New Issue
Block a user