-
Robert Knight authored
Several aspects of ngResource make it sub-optimal for our needs: 1. It mutates the model object directly after making an API call, which does not fit well with usage in a Redux app where the UI state should be an immutable object. 2. The ngResource classes can only be constructed once the API description has been retrieved. At least one place in our code, which handled newly created annotations arriving from the page, failed to account for this. This commit therefore replaces use of ngResource for making API calls to the search and annotation endpoints with a simple wrapper around HTTP requests which makes a call and then returns the resulting object. The new wrapper will wait until the API description has been received before attempting to make an API call, avoiding problem (2) above. As a bonus, this brings us a step towards decoupling the JS API client from Angular so we could re-use it outside the app in future. * Replace ngResource with simple $http wrapper in store.js * Add tests for annotation update and deletion API calls * Change tests in annotation-test.js from `assert(predicate(actual, expected))` form to `assert.predicate(actual, expected))` form as this results in errors that are _much_ easier to debug when they fail.
0d9217ec
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
memoize-test.js | ||
scope-timeout-test.js | ||
url-util-test.js |