Skip to content

Commit

Permalink
Only display error message when response has failed
Browse files Browse the repository at this point in the history
  • Loading branch information
benbarnett committed Nov 29, 2018
1 parent 1765c0f commit a54e574
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/x-gift-article/src/GiftArticle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const withGiftFormActions = withActions(
if (giftCredits > 0 || giftCredits === 0) {
return updaters.setAllowance(giftCredits, monthlyAllowance, nextRenewalDate);
} else {
// TODO do something
return { invalidResponseFromApi: true }
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions components/x-gift-article/src/Message.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styles from './GiftArticle.css';
const messageClassName = styles.message;
const boldTextClassName = styles.bold;

export default ({ shareType, isGiftUrlCreated, isFreeArticle, giftCredits, monthlyAllowance, nextRenewalDateText, redemptionLimit }) => {
export default ({ shareType, isGiftUrlCreated, isFreeArticle, giftCredits, monthlyAllowance, nextRenewalDateText, redemptionLimit, invalidResponseFromApi }) => {

if (isFreeArticle) {
return (
Expand Down Expand Up @@ -33,7 +33,7 @@ export default ({ shareType, isGiftUrlCreated, isFreeArticle, giftCredits, month
);
}

if (!giftCredits) {
if (invalidResponseFromApi) {
return (
<div className={ messageClassName }>
Unable to fetch gift credits. Please try again later
Expand Down
2 changes: 2 additions & 0 deletions components/x-gift-article/src/UrlSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default ({
redemptionLimit,
showCopyButton,
nativeShare,
invalidResponseFromApi,
actions
}) => {

Expand Down Expand Up @@ -50,6 +51,7 @@ export default ({
monthlyAllowance,
nextRenewalDateText,
redemptionLimit,
invalidResponseFromApi,
}} />

{ showUrlShareElements && <Buttons {...{
Expand Down

0 comments on commit a54e574

Please sign in to comment.