Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
remove unnecessary finished status and drop ability to reset to prist…
Browse files Browse the repository at this point in the history
…ine state.
  • Loading branch information
nerrad committed Dec 19, 2019
1 parent 3f25775 commit a1bd87c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion assets/js/base/hooks/payment-methods/constants.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export const STATUS = {
PRISTINE: 'pristine',
STARTED: 'started',
FINISHED: 'finished',
ERROR: 'has_error',
FAILED: 'failed',
SUCCESS: 'success',
Expand Down
7 changes: 4 additions & 3 deletions assets/js/base/hooks/payment-methods/use-payment-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ const usePaymentEvents = () => {
const { paymentStatus, setPaymentStatus } = useState( STATUS.PRISTINE );
const dispatch = useMemo(
() => ( {
pristine: () => setPaymentStatus( STATUS.PRISTINE ),
started: () => setPaymentStatus( STATUS.STARTED ),
finished: () => setPaymentStatus( STATUS.FINISHED ),
error: () => setPaymentStatus( STATUS.ERROR ),
failed: () => setPaymentStatus( STATUS.FAILED ),
success: () => setPaymentStatus( STATUS.SUCCESS ),
Expand All @@ -25,7 +23,10 @@ const usePaymentEvents = () => {
() => ( {
isPristine: () => paymentStatus === STATUS.PRISTINE,
isStarted: () => paymentStatus === STATUS.STARTED,
isFinished: () => paymentStatus === STATUS.FINISHED,
isFinished: () =>
[ STATUS.ERROR, STATUS.FAILED, STATUS.SUCCESS ].includes(
paymentStatus
),
hasError: () => paymentStatus === STATUS.ERROR,
hasFailed: () => paymentStatus === STATUS.FAILED,
isSuccessful: () => paymentStatus === STATUS.SUCCESS,
Expand Down

0 comments on commit a1bd87c

Please sign in to comment.