History

Use fetch helpers instead of fetch (#27026)

WIP because: - [x] Some calls set a `content-type` but send no body, can likely remove the header - [x] Need to check whether `charset=utf-8` has any significance on the webauthn calls, I assume not as it is the default for json content. - [x] Maybe `no-restricted-globals` is better for eslint, but will require a lot of duplication in the yaml or moving eslint config to a `.js` extension. - [x] Maybe export `request` as `fetch`, shadowing the global.

silverwind committed 3 years ago

Commit ae8e8f01 parent 809923817 files · +70 −98Browse files

Showing the changes to web_src/js/features/repo-diff-commit.js (1 of 17 files). Show all

Unified · Split

web_src/js/features/repo-diff-commit.js+2−1
@@ -1,9 +1,10 @@
11 import {hideElem, showElem, toggleElem} from '../utils/dom.js';
2+import {GET} from '../modules/fetch.js';
23
34 async function loadBranchesAndTags(area, loadingButton) {
45 loadingButton.classList.add('disabled');
56 try {
6− const res = await fetch(loadingButton.getAttribute('data-fetch-url'));
7+ const res = await GET(loadingButton.getAttribute('data-fetch-url'));
78 const data = await res.json();
89 hideElem(loadingButton);
910 addTags(area, data.tags);