major differences with the Fetch API - hogehoge666/syno_moments_slider GitHub Wiki

Error handling

  • Fetch API
    • Fetch generates error only when the target endpoint is unreachable
    • HTTP status code like 404 won't trigger an error
  • Axios API
    • Axios generates an error whenever a status code other than 2xx is received

Response data handling

  • Fetch API
    • you need to json() or text() to get the data
  • Axios API
    • Axios will automatically convert the response data into JSON.