@open-tender/cloud 0.1.86 → 0.1.88
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.
|
@@ -41,7 +41,7 @@ export declare const submitOrder: import("@reduxjs/toolkit").AsyncThunk<Order, v
|
|
|
41
41
|
}>;
|
|
42
42
|
export declare const submitOrderPay: import("@reduxjs/toolkit").AsyncThunk<Order | null, boolean | undefined, {
|
|
43
43
|
state: AppState;
|
|
44
|
-
rejectValue:
|
|
44
|
+
rejectValue: CheckoutErrorMessages;
|
|
45
45
|
dispatch?: Dispatch<import("redux").AnyAction> | undefined;
|
|
46
46
|
extra?: unknown;
|
|
47
47
|
serializedErrorType?: unknown;
|
|
@@ -152,14 +152,16 @@ exports.submitOrder = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.SubmitO
|
|
|
152
152
|
};
|
|
153
153
|
dispatch((0, order_1.setAlert)(alert));
|
|
154
154
|
const preparedOrder = assembleOrder(getState());
|
|
155
|
-
if (!preparedOrder)
|
|
155
|
+
if (!preparedOrder) {
|
|
156
156
|
return dispatch((0, order_1.setAlert)({ type: 'close' }));
|
|
157
|
+
}
|
|
157
158
|
try {
|
|
158
159
|
const completedOrder = yield api.postOrder(preparedOrder, token);
|
|
159
160
|
const auth = getState().customer.account.auth;
|
|
160
161
|
const { email, password } = preparedOrder.customer || {};
|
|
161
|
-
if (password && !auth)
|
|
162
|
+
if (password && !auth) {
|
|
162
163
|
yield dispatch((0, customer_1.loginCustomer)({ email: email, password }));
|
|
164
|
+
}
|
|
163
165
|
dispatch((0, order_1.setAlert)({ type: 'close' }));
|
|
164
166
|
return completedOrder;
|
|
165
167
|
}
|
|
@@ -183,14 +185,17 @@ exports.submitOrderPay = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.Subm
|
|
|
183
185
|
dispatch((0, order_1.setAlert)(alert));
|
|
184
186
|
}
|
|
185
187
|
const preparedOrder = assembleOrder(getState());
|
|
186
|
-
if (!preparedOrder)
|
|
188
|
+
if (!preparedOrder) {
|
|
187
189
|
return dispatch((0, order_1.setAlert)({ type: 'close' }));
|
|
190
|
+
}
|
|
188
191
|
try {
|
|
189
192
|
const completedOrder = yield api.postOrder(preparedOrder, token);
|
|
193
|
+
console.log('completedOrder', completedOrder);
|
|
190
194
|
const auth = getState().customer.account.auth;
|
|
191
195
|
const { email, password } = preparedOrder.customer || {};
|
|
192
|
-
if (password && !auth)
|
|
196
|
+
if (password && !auth) {
|
|
193
197
|
yield dispatch((0, customer_1.loginCustomer)({ email: email, password }));
|
|
198
|
+
}
|
|
194
199
|
dispatch((0, order_1.setAlert)({ type: 'close' }));
|
|
195
200
|
return completedOrder;
|
|
196
201
|
}
|
|
@@ -41,7 +41,7 @@ export declare const submitOrder: import("@reduxjs/toolkit").AsyncThunk<Order, v
|
|
|
41
41
|
}>;
|
|
42
42
|
export declare const submitOrderPay: import("@reduxjs/toolkit").AsyncThunk<Order | null, boolean | undefined, {
|
|
43
43
|
state: AppState;
|
|
44
|
-
rejectValue:
|
|
44
|
+
rejectValue: CheckoutErrorMessages;
|
|
45
45
|
dispatch?: Dispatch<import("redux").AnyAction> | undefined;
|
|
46
46
|
extra?: unknown;
|
|
47
47
|
serializedErrorType?: unknown;
|
|
@@ -148,14 +148,16 @@ export const submitOrder = createAsyncThunk(CheckoutActionType.SubmitOrder, (_,
|
|
|
148
148
|
};
|
|
149
149
|
dispatch(setAlert(alert));
|
|
150
150
|
const preparedOrder = assembleOrder(getState());
|
|
151
|
-
if (!preparedOrder)
|
|
151
|
+
if (!preparedOrder) {
|
|
152
152
|
return dispatch(setAlert({ type: 'close' }));
|
|
153
|
+
}
|
|
153
154
|
try {
|
|
154
155
|
const completedOrder = yield api.postOrder(preparedOrder, token);
|
|
155
156
|
const auth = getState().customer.account.auth;
|
|
156
157
|
const { email, password } = preparedOrder.customer || {};
|
|
157
|
-
if (password && !auth)
|
|
158
|
+
if (password && !auth) {
|
|
158
159
|
yield dispatch(loginCustomer({ email: email, password }));
|
|
160
|
+
}
|
|
159
161
|
dispatch(setAlert({ type: 'close' }));
|
|
160
162
|
return completedOrder;
|
|
161
163
|
}
|
|
@@ -179,14 +181,17 @@ export const submitOrderPay = createAsyncThunk(CheckoutActionType.SubmitOrderPay
|
|
|
179
181
|
dispatch(setAlert(alert));
|
|
180
182
|
}
|
|
181
183
|
const preparedOrder = assembleOrder(getState());
|
|
182
|
-
if (!preparedOrder)
|
|
184
|
+
if (!preparedOrder) {
|
|
183
185
|
return dispatch(setAlert({ type: 'close' }));
|
|
186
|
+
}
|
|
184
187
|
try {
|
|
185
188
|
const completedOrder = yield api.postOrder(preparedOrder, token);
|
|
189
|
+
console.log('completedOrder', completedOrder);
|
|
186
190
|
const auth = getState().customer.account.auth;
|
|
187
191
|
const { email, password } = preparedOrder.customer || {};
|
|
188
|
-
if (password && !auth)
|
|
192
|
+
if (password && !auth) {
|
|
189
193
|
yield dispatch(loginCustomer({ email: email, password }));
|
|
194
|
+
}
|
|
190
195
|
dispatch(setAlert({ type: 'close' }));
|
|
191
196
|
return completedOrder;
|
|
192
197
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.88",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our cloud-based Order API.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|