@feardread/feature-factory 5.0.4 → 5.0.6
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/dist/bundle.min.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/factory/thunk.js +2 -6
package/package.json
CHANGED
package/src/factory/thunk.js
CHANGED
|
@@ -18,7 +18,7 @@ const HTTP_METHODS = {
|
|
|
18
18
|
const STANDARD_OPERATIONS = {
|
|
19
19
|
all: { method: HTTP_METHODS.GET, useParams: false },
|
|
20
20
|
one: { method: HTTP_METHODS.GET, useParams: false, useIdInUrl: true },
|
|
21
|
-
search: { method: HTTP_METHODS.
|
|
21
|
+
search: { method: HTTP_METHODS.POST, useParams: true },
|
|
22
22
|
new: { method: HTTP_METHODS.POST, useParams: false },
|
|
23
23
|
create: { method: HTTP_METHODS.POST, useParams: false },
|
|
24
24
|
update: { method: HTTP_METHODS.PUT, useParams: false, useIdInUrl: true },
|
|
@@ -52,10 +52,6 @@ const validateThunkParams = (entity, prefix) => {
|
|
|
52
52
|
const buildUrl = (entity, prefix, params = {}, useIdInUrl = false) => {
|
|
53
53
|
let url = `${entity}`;
|
|
54
54
|
|
|
55
|
-
if( prefix === 'one') {
|
|
56
|
-
url += `/${params.id}`;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
55
|
if (useIdInUrl && params?.id) {
|
|
60
56
|
url += `/${params.id}`;
|
|
61
57
|
} else if (!useIdInUrl || prefix !== 'one') {
|
|
@@ -196,7 +192,7 @@ export const ThunkFactory = {
|
|
|
196
192
|
post: (entity, prefix) => {
|
|
197
193
|
return createGenericThunk(entity, prefix, {
|
|
198
194
|
method: HTTP_METHODS.POST,
|
|
199
|
-
useParams:
|
|
195
|
+
useParams: true,
|
|
200
196
|
});
|
|
201
197
|
},
|
|
202
198
|
|