Categories
Mastering Development

react native fetch hook and refresh jwt token

i have made a custom hook to fetch data from api, but the token only valid for 5 second. so i made this hook the problem is when i call the hooks from my page it called many time and the refresh token already expired when i access the api i will check the response […]

Categories
Mastering Development

Getting error from else block everytime in app but in postman it is working fine [closed]

When I am executing this program it gives me an error Account does not exists this means executing else block everytime but I tried this in Postaman with same user_id and password it is working fine it shows me user logged in . IO doesn’t know why this is happening help me solve this problem […]

Categories
Mastering Development

Interceptor for fetch and fetch retry? (Javascript)

I am trying to create an interceptor for fetch in javascript (React to be more specific). It should get the result from every fetch that gets called, and if it is an 401 error it should initiate a new fetch call to another route to get a cookie (a refresh token). Then, the original fetch […]

Categories
Mastering Development

Object Not Passing/Fetch-Post Request/API/NodeJS/Browser

Issue: An object created in JavaScript by input data from a sign up form in HTML does not seem to be created. Tried: I checked if I was referencing the entire object with {data} rather just data Searched other online resources to no avail Read again on JavaScript objects to see if I did a […]

Categories
Mastering Development

How can I bypass certificate trust error?

I am trying alamofire 5 with local https server and keep getting "The certificate for this server che certificate for this server is invalid. You might be connecting to a server that is pretending to be “192.168.0.13” which could put your confidential information at risk." How do I make app to trust the certificate and […]

Categories
Mastering Development

Can’t perform a React state update on an unmounted component with fetch POST method

I get this warning when i use my fetch post method how can I cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.With my Post methods. Warning: Can’t perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel […]

Categories
Mastering Development

Async API call handler inside event listener in react

In React, I have a text field for searching students. I am listening to the typed query inside an onChange() event handler for the searchfield, where I am also making an API call to search for students, as shown in the code snippet state = { searchResult: [] } searchStudents = (event) => { if(!event.target.value) […]

Categories
Mastering Development

How to solve icon toggle on add/remove to favourite in React

Hey there i am having some trouble when adding/deleting a favourite. When i toggle the heart icon it does what it is supposed to in the backend, so it adds or it removes correctly an item from the favourites. The issue is that if i add an item to favourites, the icon becomes a full […]

Categories
Mastering Development

React and Node application not uploading Images to Cloudinary, 404 error with no explanation

I am trying to upload an image to cloudinary. I am using this resource as my tutorial… I am able to render a preview of the image onto my screen and I console log the base64 encoded url, and it works as it is supposed to. After I select my Image, I hit upload and […]

Categories
Mastering Development

prevent multiple http request send by using fetch

I’m creating a chrome extension, in which I take input from using prompt and send it to the server using an HTTP request. By doing this I’m facing duplication of data, which means the extension is sending multiple requests to the server, which I want to prevent. (Note: by taking data from prompt only once […]