You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

userUpdateRequest.js 469B

1234567891011121314151617181920
  1. import apiEndpoints from '../apiEndpoints';
  2. export const updateUser = async (userData, _id) => {
  3. console.log(userData, _id);
  4. const response = await fetch(apiEndpoints.userUpdate, {
  5. method: 'PATCH',
  6. body: JSON.stringify({ userData, _id }),
  7. headers: {
  8. 'Content-Type': 'application/json',
  9. },
  10. });
  11. const data = await response.json();
  12. if (!response.ok) {
  13. throw new Error(data.message || 'Something went wrong!');
  14. }
  15. return data;
  16. };