@open-tender/cloud
Advanced tools
Comparing version 0.1.86 to 0.1.87
@@ -44,3 +44,3 @@ import { Dispatch } from '@reduxjs/toolkit'; | ||
state: AppState; | ||
rejectValue: Record<string, unknown>; | ||
rejectValue: CheckoutErrorMessages; | ||
dispatch?: Dispatch<import("redux").AnyAction> | undefined; | ||
@@ -47,0 +47,0 @@ extra?: unknown; |
@@ -155,4 +155,5 @@ "use strict"; | ||
const preparedOrder = assembleOrder(getState()); | ||
if (!preparedOrder) | ||
if (!preparedOrder) { | ||
return dispatch((0, order_1.setAlert)({ type: 'close' })); | ||
} | ||
try { | ||
@@ -162,4 +163,5 @@ const completedOrder = yield api.postOrder(preparedOrder, token); | ||
const { email, password } = preparedOrder.customer || {}; | ||
if (password && !auth) | ||
if (password && !auth) { | ||
yield dispatch((0, customer_1.loginCustomer)({ email: email, password })); | ||
} | ||
dispatch((0, order_1.setAlert)({ type: 'close' })); | ||
@@ -188,4 +190,5 @@ return completedOrder; | ||
const preparedOrder = assembleOrder(getState()); | ||
if (!preparedOrder) | ||
if (!preparedOrder) { | ||
return dispatch((0, order_1.setAlert)({ type: 'close' })); | ||
} | ||
try { | ||
@@ -195,4 +198,5 @@ const completedOrder = yield api.postOrder(preparedOrder, token); | ||
const { email, password } = preparedOrder.customer || {}; | ||
if (password && !auth) | ||
if (password && !auth) { | ||
yield dispatch((0, customer_1.loginCustomer)({ email: email, password })); | ||
} | ||
dispatch((0, order_1.setAlert)({ type: 'close' })); | ||
@@ -285,2 +289,13 @@ return completedOrder; | ||
state.errors = action.payload || {}; | ||
}) | ||
.addCase(exports.submitOrderPay.fulfilled, (_, action) => { | ||
return Object.assign(Object.assign({}, initialState), { completedOrder: action.payload }); | ||
}) | ||
.addCase(exports.submitOrderPay.pending, state => { | ||
state.loading = 'pending'; | ||
}) | ||
.addCase(exports.submitOrderPay.rejected, (state, action) => { | ||
state.loading = 'idle'; | ||
state.submitting = false; | ||
state.errors = action.payload || {}; | ||
}); | ||
@@ -287,0 +302,0 @@ } |
@@ -44,3 +44,3 @@ import { Dispatch } from '@reduxjs/toolkit'; | ||
state: AppState; | ||
rejectValue: Record<string, unknown>; | ||
rejectValue: CheckoutErrorMessages; | ||
dispatch?: Dispatch<import("redux").AnyAction> | undefined; | ||
@@ -47,0 +47,0 @@ extra?: unknown; |
@@ -151,4 +151,5 @@ import { __awaiter } from "tslib"; | ||
const preparedOrder = assembleOrder(getState()); | ||
if (!preparedOrder) | ||
if (!preparedOrder) { | ||
return dispatch(setAlert({ type: 'close' })); | ||
} | ||
try { | ||
@@ -158,4 +159,5 @@ const completedOrder = yield api.postOrder(preparedOrder, token); | ||
const { email, password } = preparedOrder.customer || {}; | ||
if (password && !auth) | ||
if (password && !auth) { | ||
yield dispatch(loginCustomer({ email: email, password })); | ||
} | ||
dispatch(setAlert({ type: 'close' })); | ||
@@ -184,4 +186,5 @@ return completedOrder; | ||
const preparedOrder = assembleOrder(getState()); | ||
if (!preparedOrder) | ||
if (!preparedOrder) { | ||
return dispatch(setAlert({ type: 'close' })); | ||
} | ||
try { | ||
@@ -191,4 +194,5 @@ const completedOrder = yield api.postOrder(preparedOrder, token); | ||
const { email, password } = preparedOrder.customer || {}; | ||
if (password && !auth) | ||
if (password && !auth) { | ||
yield dispatch(loginCustomer({ email: email, password })); | ||
} | ||
dispatch(setAlert({ type: 'close' })); | ||
@@ -281,2 +285,13 @@ return completedOrder; | ||
state.errors = action.payload || {}; | ||
}) | ||
.addCase(submitOrderPay.fulfilled, (_, action) => { | ||
return Object.assign(Object.assign({}, initialState), { completedOrder: action.payload }); | ||
}) | ||
.addCase(submitOrderPay.pending, state => { | ||
state.loading = 'pending'; | ||
}) | ||
.addCase(submitOrderPay.rejected, (state, action) => { | ||
state.loading = 'idle'; | ||
state.submitting = false; | ||
state.errors = action.payload || {}; | ||
}); | ||
@@ -283,0 +298,0 @@ } |
{ | ||
"name": "@open-tender/cloud", | ||
"version": "0.1.86", | ||
"version": "0.1.87", | ||
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our cloud-based Order API.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
911841
20616