Fetch the edit API in the view

The edit API is called in the view using a fetch method that takes the form data and sends the multipart request to the backend.

mern-marketplace/client/shop/api-shop.js:

const update = (params, credentials, shop) => {  return fetch('/api/shops/' + params.shopId, {    method: 'PUT',    headers: {      'Accept': 'application/json',      'Authorization': 'Bearer ' + credentials.t    },    body: shop  }).then((response) => {    return response.json()  }).catch((err) => {    console.log(err)  })}

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.