utils.js 310 B

123456789101112
  1. "use strict";
  2. async function fetchWithToken(url, options) {
  3. const authToken = localStorage.getItem('token');
  4. return await fetch(url, {...options, headers: {
  5. 'Authorization': `Bearer ${authToken}`,
  6. 'Content-Type': 'application/json',
  7. }});
  8. }
  9. export { fetchWithToken };