Unable to PUT data in todos

Good afternoon! I got an issue. Currently i am learning rest API and the way it works, written little code that simply takes data from your todo lists and puts it on the screen, but when i came to editing data, like changing todo status from pending to complete and backwards, i had faced an issue. every single time i try to put something, post just simply self-removes for no reason. i had tried variety of ways to solve this, even removed delete method from my api, but it still doesnt work. i would be very grateful if you would be able to help me out with it! Shortly: When i use PUT method, it removes whole post instead of changing data in it. Thanks in advance!

https://codepen.io/bcehaxep/pen/qBJGqYa - here is link to my code. JS file is custom.js, css file is API.js. I would be really grateful if somehow you would be able to help me

https://codepen.io/bcehaxep/pen/qBJGqYa - here is link to my code. JS file is custom.js, css file is API.js. I would be really grateful if somehow you would be able to help me

You need pass the token to get the data that you created or modified. Default your will get only public dara

Oh thank you! Can you please tell me what is the way to do it?(where should I put token/which part of code should I change) thanks in advance!

you can use the same way that you send your token for PUT POST and DELETE requests. either in headers as Bearer token or in the url as query parameter

ex: https://gorest.co.in/public/v2/users?access-token=xxx

Thanks! I had tried to, but it still didnt work. I had set up my headers for requests in static class on top of API.js, which also includes 'Authorization': Bearer ${this.TOKEN}, which i apply to every single request, so i feel like it is something different. and i am trying to edit todo's, not user data. Is there anything else i should try? Or should i just try to work with user data instead of todo list


Little markdown supported