From b86ab773dd0db28f34b6daa172840bd3177ee8b1 Mon Sep 17 00:00:00 2001 From: Darren Ethier Date: Thu, 5 Mar 2020 12:01:02 -0500 Subject: [PATCH] Add useBillingData and useStoreOrder hooks (in progress/todo) --- assets/js/base/hooks/order/index.js | 2 ++ assets/js/base/hooks/order/use-billing-data.js | 12 ++++++++++++ assets/js/base/hooks/order/use-store-order.js | 9 +++++++++ 3 files changed, 23 insertions(+) create mode 100644 assets/js/base/hooks/order/index.js create mode 100644 assets/js/base/hooks/order/use-billing-data.js create mode 100644 assets/js/base/hooks/order/use-store-order.js diff --git a/assets/js/base/hooks/order/index.js b/assets/js/base/hooks/order/index.js new file mode 100644 index 00000000000..abf8fc8fead --- /dev/null +++ b/assets/js/base/hooks/order/index.js @@ -0,0 +1,2 @@ +export * from './use-billing-data'; +export * from './use-store-order'; diff --git a/assets/js/base/hooks/order/use-billing-data.js b/assets/js/base/hooks/order/use-billing-data.js new file mode 100644 index 00000000000..5a785fdec74 --- /dev/null +++ b/assets/js/base/hooks/order/use-billing-data.js @@ -0,0 +1,12 @@ +/** + * External dependencies + */ +import { usePaymentMethodDataContext } from '@woocommerce/base-context'; + +export const useBillingData = () => { + const { billingData, setBillingData } = usePaymentMethodDataContext(); + return { + billingData, + setBillingData, + }; +}; diff --git a/assets/js/base/hooks/order/use-store-order.js b/assets/js/base/hooks/order/use-store-order.js new file mode 100644 index 00000000000..a5dc7cb7467 --- /dev/null +++ b/assets/js/base/hooks/order/use-store-order.js @@ -0,0 +1,9 @@ +// @todo finish out this hook which will return a store draft order object. + +export const useStoreOrder = () => { + const order = {}; + return { + order, + isLoading: false, + }; +};