Skip to content

WDFN-646 - Remove ajax.js package and replace with the native fetchAPI

Bucknell, Mary S. requested to merge mbucknell/waterdataui:wdfn-646 into main

Before making a pull request

  • Run all linters (make lint)
  • Run all tests (make test)
  • Update the changelog appropriately
  • If making a release, update code.json, versionNumber and metadataLastUpdated.


Replaced the ajax module with the javascript fetch API. While doing this work, I refactored the flood levels fetching to put the fetch in a different module from the FIM data and also removed "waterwatch" from function and variable names in favor of just using floodLevels.

I tried to standardize how the fetchAPI is used, how bad requests are handled, and how failed requests are handled. As a note, I ran the tests completely off of the internet to ensure none of the tests where trying to make requests (fetch or XMLHttpRequest) without them being mocked. The tests all passed with no error messages.

After making a pull request

  • If appropriate, put the link to the PR in the JIRA ticket
  • Assign someone to review unless the change is trivial

Merge request reports