@pisell/private-materials 3.0.24 → 3.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -80,10 +80,13 @@ var Payments = Provider(function (props) {
80
80
  _useState6 = _slicedToArray(_useState5, 2),
81
81
  refundAmount = _useState6[0],
82
82
  setRefundAmount = _useState6[1];
83
+ var init = function init() {
84
+ getPayments();
85
+ getRefundInfo();
86
+ };
83
87
  useEffect(function () {
84
- if (!!state.bookingId) {
85
- getPayments();
86
- getRefundInfo();
88
+ if (state.bookingDetail) {
89
+ init();
87
90
  state.action({
88
91
  type: "pisell1.registerPlugin",
89
92
  data: {
@@ -91,7 +94,7 @@ var Payments = Provider(function (props) {
91
94
  }
92
95
  });
93
96
  }
94
- }, [state.bookingId]);
97
+ }, [state.bookingDetail, state.refresh]);
95
98
  var getRefundInfo = /*#__PURE__*/function () {
96
99
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
97
100
  var res;
@@ -66,10 +66,13 @@ var Payments = (0, import_model.Provider)((props) => {
66
66
  const [loading, setLoading] = (0, import_react.useState)(false);
67
67
  const [paymentList, setPaymentList] = (0, import_react.useState)([]);
68
68
  const [refundAmount, setRefundAmount] = (0, import_react.useState)();
69
+ const init = () => {
70
+ getPayments();
71
+ getRefundInfo();
72
+ };
69
73
  (0, import_react.useEffect)(() => {
70
- if (!!state.bookingId) {
71
- getPayments();
72
- getRefundInfo();
74
+ if (state.bookingDetail) {
75
+ init();
73
76
  state.action({
74
77
  type: "pisell1.registerPlugin",
75
78
  data: {
@@ -77,7 +80,7 @@ var Payments = (0, import_model.Provider)((props) => {
77
80
  }
78
81
  });
79
82
  }
80
- }, [state.bookingId]);
83
+ }, [state.bookingDetail, state.refresh]);
81
84
  const getRefundInfo = async () => {
82
85
  const res = await state.apis.getRefundInfo();
83
86
  setRefundAmount(res.total_refund_amount);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.0.24",
3
+ "version": "3.0.26",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",