aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2023-09-11 10:25:10 +0200
committerGitHub <noreply@github.com>2023-09-11 10:25:10 +0200
commit6d96f0b0d1c74523b9f3d26360aa63d92c307959 (patch)
treefe21b5a13bdab4d75f0ab1253dc9b18380c559fc /docs/content
parent148c9c4b0500007d465156e4c2d7ff6873d23577 (diff)
downloadgitea-6d96f0b0d1c74523b9f3d26360aa63d92c307959.tar.gz
gitea-6d96f0b0d1c74523b9f3d26360aa63d92c307959.zip
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>
Diffstat (limited to 'docs/content')
-rw-r--r--docs/content/contributing/guidelines-frontend.en-us.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/content/contributing/guidelines-frontend.en-us.md b/docs/content/contributing/guidelines-frontend.en-us.md
index dc9eef1303..921c2b0233 100644
--- a/docs/content/contributing/guidelines-frontend.en-us.md
+++ b/docs/content/contributing/guidelines-frontend.en-us.md
@@ -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.
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`
The usage of `dataset` is forbidden, its camel-casing behaviour makes it hard to grep for attributes.