Skip to content

Instantly share code, notes, and snippets.

@ms314006
Last active January 29, 2023 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ms314006/2e14a5cde2bdca0eb9506dac60cef6a9 to your computer and use it in GitHub Desktop.
Save ms314006/2e14a5cde2bdca0eb9506dac60cef6a9 to your computer and use it in GitHub Desktop.
const TransactionInfo = (transaction) => {
const getTransactionInfo = () => {
if (transaction.status === 'SUCCESS') {
return {
statusString: '成功',
isNonRefundable: false,
};
}
return {
statusString: '失敗',
isNonRefundable: true,
};
};
return (
<div>
<label>交易狀態:</label>
<span>{ getTransactionInfo().statusString }</span>
<button disabled={getTransactionInfo().isNonRefundable}>
退款
</button>
</div>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment