i making a react project, I'm trying to fetch data to server and build business card. when I'm using postman everything works good but when I'm fetching data from client-side(web),i get an error 406.the object of the card is ok and full of the details i ask for, also the token witch i get from local storage.
this is my fetch function. I'm also adding photo of the error and photo of postman when it worked there
const handleCreateCard = async (e) => { e.preventDefault();
const card = { bisCard }; const requestMethods = { method: "POST", headers: { "Content-Type": "application/json", token: getUserData.token, }, body: JSON.stringify(card.bisCard), }; console.log(getUserData.token); try { const response = await fetch( "http://localhost:8000/cards/create", requestMethods ); if (response.ok) console.log(response); else { console.log(response); } } catch (err) { console.log("!!!!", err); } };
