@open-tender/cloud 0.4.11 → 0.4.12

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.
@@ -6,6 +6,7 @@ const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const types_1 = require("../types");
7
7
  const types_2 = require("@open-tender/types");
8
8
  const account_1 = require("./account");
9
+ const notifications_1 = require("../notifications");
9
10
  const initialState = {
10
11
  tpls: null,
11
12
  error: null,
@@ -30,13 +31,15 @@ exports.fetchCustomerTpls = (0, toolkit_1.createAsyncThunk)(CustomerTplsActionTy
30
31
  return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
31
32
  }
32
33
  }));
33
- exports.verifyCustomerTpls = (0, toolkit_1.createAsyncThunk)(CustomerTplsActionType.VerifyCustomerTpls, (_, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
34
+ exports.verifyCustomerTpls = (0, toolkit_1.createAsyncThunk)(CustomerTplsActionType.VerifyCustomerTpls, (_, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
34
35
  try {
35
36
  const api = getState().config.api;
36
37
  const token = (0, account_1.selectToken)(getState());
37
38
  if (!token)
38
39
  throw new Error(types_2.MISSING_CUSTOMER);
39
- return yield api.postCustomerTplsVerify(token);
40
+ yield api.postCustomerTplsVerify(token);
41
+ dispatch((0, notifications_1.showNotification)('Verification email sent!'));
42
+ return;
40
43
  }
41
44
  catch (err) {
42
45
  return rejectWithValue(err);
@@ -3,6 +3,7 @@ import { createAsyncThunk, createSelector, createSlice } from '@reduxjs/toolkit'
3
3
  import { ReducerType } from '../types';
4
4
  import { MISSING_CUSTOMER } from '@open-tender/types';
5
5
  import { checkAuth, selectToken } from './account';
6
+ import { showNotification } from '../notifications';
6
7
  const initialState = {
7
8
  tpls: null,
8
9
  error: null,
@@ -27,13 +28,15 @@ export const fetchCustomerTpls = createAsyncThunk(CustomerTplsActionType.FetchCu
27
28
  return checkAuth(error, dispatch, () => rejectWithValue(error));
28
29
  }
29
30
  }));
30
- export const verifyCustomerTpls = createAsyncThunk(CustomerTplsActionType.VerifyCustomerTpls, (_, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
31
+ export const verifyCustomerTpls = createAsyncThunk(CustomerTplsActionType.VerifyCustomerTpls, (_, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
31
32
  try {
32
33
  const api = getState().config.api;
33
34
  const token = selectToken(getState());
34
35
  if (!token)
35
36
  throw new Error(MISSING_CUSTOMER);
36
- return yield api.postCustomerTplsVerify(token);
37
+ yield api.postCustomerTplsVerify(token);
38
+ dispatch(showNotification('Verification email sent!'));
39
+ return;
37
40
  }
38
41
  catch (err) {
39
42
  return rejectWithValue(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/cloud",
3
- "version": "0.4.11",
3
+ "version": "0.4.12",
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",