Skip to content

Commit

Permalink
refactor: minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Saksham Sharma authored and Saksham Sharma committed Aug 5, 2024
1 parent 85b1f4c commit 4789a23
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Hooks/UtilityHooks.res
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ let useIsGuestCustomer = () => {
}

let useHandlePostMessages = (~complete, ~empty, ~paymentType, ~savedMethod=false) => {
open RecoilAtoms

let loggerState = Recoil.useRecoilValueFromAtom(RecoilAtoms.loggerAtom)
let setIsPayNowButtonDisable = RecoilAtoms.payNowButtonDisable->Recoil.useSetRecoilState
let {sdkHandleConfirmPayment} = optionAtom->Recoil.useRecoilValueFromAtom

React.useEffect(() => {
if !sdkHandleConfirmPayment.allowButtonBeforeValidation {
let isCompletelyFilled = complete && paymentType !== ""
setIsPayNowButtonDisable(_ => !isCompletelyFilled)
}
Utils.handlePostMessageEvents(~complete, ~empty, ~paymentType, ~loggerState, ~savedMethod)
None
}, (complete, empty, paymentType))
Expand Down

0 comments on commit 4789a23

Please sign in to comment.