mirror of
https://gitea.com/gitea/docs.git
synced 2026-07-22 02:37:42 +00:00
Add fetch wrappers, ignore network errors in actions view (#26985)
1. Introduce lightweight `fetch` wrapper functions that automatically sets csfr token, content-type and use it in `RepoActionView.vue`. 2. Fix a specific issue on `RepoActionView.vue` where a fetch network error is shortly visible during page reload sometimes. It can be reproduced by F5-in in quick succession on the actions view page and was also producing a red error box on the page. Once approved, we can replace all current `fetch` uses in UI with this in another PR. --------- Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
@@ -92,6 +92,12 @@ it's recommended to use `const _promise = asyncFoo()` to tell readers
|
|||||||
that this is done by purpose, we want to call the async function and ignore the Promise.
|
that this is done by purpose, we want to call the async function and ignore the Promise.
|
||||||
Some lint rules and IDEs also have warnings if the returned Promise is not handled.
|
Some lint rules and IDEs also have warnings if the returned Promise is not handled.
|
||||||
|
|
||||||
|
### Fetching data
|
||||||
|
|
||||||
|
To fetch data, use the wrapper functions `GET`, `POST` etc. from `modules/fetch.js`. They
|
||||||
|
accept a `data` option for the content, will automatically set CSFR token and return a
|
||||||
|
Promise for a [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response).
|
||||||
|
|
||||||
### HTML Attributes and `dataset`
|
### HTML Attributes and `dataset`
|
||||||
|
|
||||||
The usage of `dataset` is forbidden, its camel-casing behaviour makes it hard to grep for attributes.
|
The usage of `dataset` is forbidden, its camel-casing behaviour makes it hard to grep for attributes.
|
||||||
|
|||||||
Reference in New Issue
Block a user