Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. function deleteNoteRequest(noteId, cb) {
  2. fetch(`${Config.API_ENDPOINT}/api/notes/${noteId}`, {
  3. method: "delete",
  4. headers: {
  5. "content-type": "application/json",
  6. Authorization: `Bearer ${Config.API_KEY}`
  7. }
  8. })
  9. .then(res => {
  10. if (!res.ok) {
  11. return res.json().then(error => Promise.reject(error));
  12. }
  13. console.log(res.json());
  14. })
  15. .then(data => {
  16. cb(noteId);
  17. })
  18. .catch(error => {
  19. console.error(error);
  20. });
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement