Skip to content
Advertisement

Uncomplete payload | React & Redux Toolkit

I have a big problem,maybe it’s not so big but i dont sleep for almost 24h because of it.I barely finished this Slice,but now,when i submit the data,i get only the automatically set id..
So,to be clear.I have a skill component where i have 2 input forms and a button,i need to retrieve data from both inputs,and then,when they are being submited,to be fetched and saved in persistor. Till now everything is good,i introduce data,the post request is successeful,but,the payload is only with the id that mirage js generates automatically.But i need to have an array with Type,Range props and with their values,and everytime i click on the button the array of this objects should be populated.
This is my component:
enter image description here
Here i submit data:
enter image description here

And as you can see,only the id is present there.. I’m stucked…
enter image description here

And above is the list when i submited data 6 times.. only the id,i dont know what may be the problem,please help..
Skill component:

JavaScript

Slicer:

JavaScript

Miragejs server where i mock the apis:

JavaScript

And root reducer:

JavaScript

Advertisement

Answer

You are dispatching addNewSkill with a string value whereas you are expecting an object in thunk middleware.

JavaScript

You should replace your handleAction with this.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement