@feardread/feature-factory 2.0.0 → 2.0.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feardread/feature-factory",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "rollup -c",
@@ -5,11 +5,11 @@ import cache from "../cache/cache.js";
5
5
 
6
6
 
7
7
 
8
- const InstanceFactory = ( options ) => {
9
-
8
+ const InstanceFactory = (( options ) => {
9
+ console.log('Instance Opts = ', options)
10
10
  const API_BASE_URL = (options.API_BASE_URL)
11
11
  ? options.API_BASE_URL
12
- : "http://fear.master.com:4000/fear/api/";
12
+ : "http://fear.master.com/fear/api/";
13
13
 
14
14
  const ACCESS_TOKEN_NAME = (options.JWT_TOKEN)
15
15
  ? options.JWT_TOKEN
@@ -71,7 +71,7 @@ const InstanceFactory = ( options ) => {
71
71
  );
72
72
 
73
73
  return instance;
74
- }
74
+ })();
75
75
 
76
76
 
77
77
 
@@ -8,13 +8,15 @@ const StateFactory = (entity, data = null) => ({
8
8
  error: null
9
9
  });
10
10
 
11
- const FeatureFactory = (sliceName, endpoint, options = {}) => {
12
- const apiEndpoint = `${sliceName}/${endpoint}`;
13
11
  const API = InstanceFactory({
14
- API_BASE_URL: 'http://fear.master.com:4000/fear/api',
12
+ API_BASE_URL: 'http://localhost:4000/fear/api',
15
13
  JWT_TOKEN: 'fear-x-token'
16
14
  });
17
15
 
16
+ const FeatureFactory = (sliceName, endpoint, options = {}) => {
17
+ const apiEndpoint = `${sliceName}/${endpoint}`;
18
+
19
+
18
20
  const fetch = createAsyncThunk(
19
21
  apiEndpoint,
20
22
  async (_, { rejectWithValue }) => {
@@ -62,7 +64,7 @@ const FeatureFactory = (sliceName, endpoint, options = {}) => {
62
64
  );
63
65
 
64
66
  const slice = createSlice({
65
- sliceName,
67
+ name: sliceName,
66
68
  initialState: StateFactory(sliceName, options.initialState || {}),
67
69
  reducers: {
68
70
  clearData: (state) => {
@@ -116,7 +118,6 @@ const FeatureFactory = (sliceName, endpoint, options = {}) => {
116
118
  return {
117
119
  reducer: slice.reducer,
118
120
  actions: slice.actions,
119
- instance: API,
120
121
  asyncActions: {
121
122
  fetch,
122
123
  fetchOne,