Repository URL to install this package:
|
Version:
3.0.10 ▾
|
import { action, observable } from 'xmobx/mobx'
import { isFunction } from 'exotic'
class ShippingAddressFormState {
@observable
shippingAddress = {}
@action
setShippingAddressForm(form) {
this.shippingAddress = form
}
@action.bound
handleShippingAddressFormBlur = () => {
const { validateForm, state, props } = this.shippingAddress
const { onFormBlur, hasBlurValidation } = props
if (hasBlurValidation === true) {
const isValidForm = validateForm()
if (isValidForm === true && isFunction(onFormBlur)) {
onFormBlur({ props, state })
}
}
}
}
// Object Creation
const shippingAddressFormState = new ShippingAddressFormState()
export { shippingAddressFormState }
export default shippingAddressFormState