So im trying to create refreshtoken hook in react. and nodejs with express as my backend. my backend code looks like this the problem is when i try this endpoint with Postwoman (chrome extension) its WORK but when i try with React + axios the server return is here is my react code Answer I’m sending the wrong access token.
Tag: axios
Axios request works only on second request
I am building a user login system and currently the way I have it set up, the user types in their email and password and then that information is sent to my server to be checked if accurate. If it is, I create a JWT token and send it back along with the mongodb _id of the user, I then
Getting JSON object from a arraylist
I have specific problem with axios to getting JSON object from my arraylist, so instead of display my displayName on my nav bar, it display all response headers information, i don’t know why ? : that my json list from my localhost : that my code : Answer Take a look at the axios docs. The response object contains much
Axios Request returns 404 even though URL is valid and the API functions correctly [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 9 months ago. Improve this question
Why axios.patch doesn’t change data in ToDoList?
Roughly speaking, I have a ToDoList in which I want to change the written task text. But on demand to find an error. The data from the input that enters the changed text is stored in the state (editingText), with this text I’m trying to replace the value in the ‘text’ column. Does anyone know what could be the problem
Nodejs wait till async function completes and print the results
I want to wait on the HTTP POST request to complete and then return response to the caller function. I am getting Undefined when I print the received results. I have defined post method as below: And I am calling it in this way: I don’t want to handle the .then and .catch in the calling function as I want
create image in React from backend dataURL
I’m trying to get a snapshot of HTML canvas like so: which seems to be working, and connected properly to the database. But I can’t figure out how to use the dataURL to create an image component on the React frontend I’m able to fetch them from the backend just fine and log the dataURL. I guess I’m just not
Refresh data through a new GET request – React Dropdown
I have this Dropdown Menu (done with MUI) which allows to choose the day value. When it changes, I’d like it to make a new GET request with the new parameter, but I don’t know how to do it as it uses useEffect. My function to fetch data My dropdown menu : Answer You can add day as dependency in
Node.js/Axios/Cheerio Web Scraping – issue with Promises
I have an issue with part of my web scraping program. The return res.send(statsArray) line in index.js always returns an empty array on the initial run (using npm start), and will only return a properly filled array after at least one refresh. Here is relevant index.html (if needed): Here is my app.js, the file linked by index.html: Here is the
Split array data from fetch data
I fetch this data from the api then i want to split this into two array i try using split function but it didn’t work, when i check for array.length, console said it undefined. when i console.log(array) it show like this Help me please. Answer First, This is not an array it’s an object. You can use Object.keys and Object.value