diff --git a/components/x-gift-article/src/SharingOptionsToggler.jsx b/components/x-gift-article/src/SharingOptionsToggler.jsx index 8d3090f5f..f47c78a71 100644 --- a/components/x-gift-article/src/SharingOptionsToggler.jsx +++ b/components/x-gift-article/src/SharingOptionsToggler.jsx @@ -18,7 +18,6 @@ export const SharingOptionsToggler = (props) => { actions.showAdvancedSharingOptions() } else { actions.hideNonSubscriberSharingOptions(event) - actions.setIncludeHighlights(event.target.checked) } return } diff --git a/components/x-gift-article/src/lib/highlightsApi.js b/components/x-gift-article/src/lib/highlightsApi.js index b4a75e29e..cbe509909 100644 --- a/components/x-gift-article/src/lib/highlightsApi.js +++ b/components/x-gift-article/src/lib/highlightsApi.js @@ -38,6 +38,11 @@ export default class HighlightsApiClient { ) const response = await fetch(url, options) + + if (!response.ok) { + throw new Error(`failed to fetch ${url}, received ${response.status}`) + } + const responseJSON = await response.json() return responseJSON } @@ -62,6 +67,7 @@ export default class HighlightsApiClient { if (!includeHighlights) { return {} } + return await this.fetchJson('/create-token', { method: 'POST', body: JSON.stringify({ articleId })