API call cannot be performed. The following params were not specified: id
Opened this issue · 4 comments
Hi, I'm using redux-saga for async actions. And faced with this issue. I'm getting the error (proxyConsole.js:56 The "putJob" API call cannot be performed. The following params were not specified: id) when trying to make a put
request.
But I don't have this error for get
method in exact same code.
api.js
...
putJob: { method: put, path: "/jobs/:id" },
...
putJobSaga.js
...
const newJob = yield call(API.putJob, { id: id });
...
might there be a specific moment in your app where the provided id
is null?
Nope, id
is not null or undefined, it's valid. Literally, to make it work I can just change method: put
to get
and everything works. And it's not working even if I manually type id
in saga.
Looks like there is some sort of issue in passing id from saga to put method.
I've noticed this as well since I have some post endpoints that don't require a body. It's unlikely that it's related to redux-saga.
With someEndpoint: { method: post, path: '/post/:id/doStuff/' }
dispatching api.someEndpoint({ id: 12 })
will error.
dispatching api.someEndpoint({ id: 12 }, null)
will succeed.
@uzikone The different signature lengths aren't entirely clear in the readme, though they are in the source.
get, destroy =
(placeholders)
or
(placeholders, options)
post, put, patch =
(body)
or
(placeholders, body)
or
(placeholders, body, options)