diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-06-16 14:32:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-16 06:32:43 +0000 |
commit | b71cb7acdc8840c9fc16b496c90a048051d15823 (patch) | |
tree | fae5454a2c9f1a7d510255260b562519681841c0 /modules/context/base.go | |
parent | a305c37e62eca42aaad16b4521520bad6bca58d2 (diff) | |
download | gitea-b71cb7acdc8840c9fc16b496c90a048051d15823.tar.gz gitea-b71cb7acdc8840c9fc16b496c90a048051d15823.zip |
Use fetch to send requests to create issues/comments (#25258)
Follow #23290
Network error won't make content lost. And this is a much better
approach than "loading-button".
The UI is not perfect and there are still some TODOs, they can be done
in following PRs, not a must in this PR's scope.
<details>
![image](https://github.com/go-gitea/gitea/assets/2114189/c94ba958-aa46-4747-8ddf-6584deeed25c)
</details>
Diffstat (limited to 'modules/context/base.go')
-rw-r--r-- | modules/context/base.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/context/base.go b/modules/context/base.go index 5ae5e65d3e..c8238050f9 100644 --- a/modules/context/base.go +++ b/modules/context/base.go @@ -136,6 +136,10 @@ func (b *Base) JSONRedirect(redirect string) { b.JSON(http.StatusOK, map[string]any{"redirect": redirect}) } +func (b *Base) JSONError(msg string) { + b.JSON(http.StatusBadRequest, map[string]any{"errorMessage": msg}) +} + // RemoteAddr returns the client machine ip address func (b *Base) RemoteAddr() string { return b.Req.RemoteAddr |