Preview:
const API_BASE_URL = 'https://dev.memate.com.au/api/v1';


export const fetchExpenses = async () => {
  const myHeaders = new Headers();
  const accessToken = sessionStorage.getItem("access_token");
  myHeaders.append("Authorization", `Bearer ${accessToken}`);
  myHeaders.append("Content-Type", `application/json`);

  const requestOptions = {
    method: 'GET',
    headers: myHeaders,
    redirect: 'follow'
  };

  try {
    const response = await fetch(`${API_BASE_URL}/expenses/`, requestOptions);
    //const result = await response.text();
    const data = await response.json();
    return data;
  } catch (error) {
    console.error('Expenses  fetch error:', error);
    throw error;
  }
};
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter