Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

96
Views
post request using crud crud in react js

Trying post request in crud crud dynamically using fetch api but its showing error net::ERR_ABORTED 415 (Unsupported Media Type)

const addItemToCartHandler = async (item) => {
 const data = {
      id: item.id,
      price: item.price,
      title: item.title,
    };

    const response = await fetch(
      `https://crudcrud.com/api/48b546b22bf645d89b3f91c1f04f7cdd/cart${authCtx.idToken}`,
      {
        body: JSON.stringify(data),
        method:'POST',
        headers: {
          "Content-type": "application/json",
        },
        mode: "no-cors",
      }
    );
    if (response.ok) {
      console.log(response);
    }
}
7 months ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.