diff options
author | Yarden Shoham <git@yardenshoham.com> | 2024-02-24 14:03:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-24 13:03:53 +0100 |
commit | 267dbb4e938cc42dc09a4a893cca631b2f755557 (patch) | |
tree | 9e32af1fbf0bb7c5c6bc65cb15f515c7d569d4f0 | |
parent | 553d46e6f6a144905266d58315a2b0ff2e976380 (diff) | |
download | gitea-267dbb4e938cc42dc09a4a893cca631b2f755557.tar.gz gitea-267dbb4e938cc42dc09a4a893cca631b2f755557.zip |
Remove jQuery from the issue reference context popup (#29367)
- Removed all jQuery calls
- Tested the context popup functionality and it works as before
# Demo without jQuery
![action](https://github.com/go-gitea/gitea/assets/20454870/90b53de5-a8e9-4ed7-9236-1c9dfc324f38)
---------
Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
-rw-r--r-- | web_src/js/components/ContextPopup.vue | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/web_src/js/components/ContextPopup.vue b/web_src/js/components/ContextPopup.vue index d9e6da316c..3a1b828cca 100644 --- a/web_src/js/components/ContextPopup.vue +++ b/web_src/js/components/ContextPopup.vue @@ -1,8 +1,8 @@ <script> -import $ from 'jquery'; import {SvgIcon} from '../svg.js'; import {useLightTextOnBackground} from '../utils/color.js'; import tinycolor from 'tinycolor2'; +import {GET} from '../modules/fetch.js'; const {appSubUrl, i18n} = window.config; @@ -80,20 +80,23 @@ export default { }); }, methods: { - load(data) { + async load(data) { this.loading = true; this.i18nErrorMessage = null; - $.get(`${appSubUrl}/${data.owner}/${data.repo}/issues/${data.index}/info`).done((issue) => { - this.issue = issue; - }).fail((jqXHR) => { - if (jqXHR.responseJSON && jqXHR.responseJSON.message) { - this.i18nErrorMessage = jqXHR.responseJSON.message; - } else { - this.i18nErrorMessage = i18n.network_error; + + try { + const response = await GET(`${appSubUrl}/${data.owner}/${data.repo}/issues/${data.index}/info`); + const respJson = await response.json(); + if (!response.ok) { + this.i18nErrorMessage = respJson.message ?? i18n.network_error; + return; } - }).always(() => { + this.issue = respJson; + } catch { + this.i18nErrorMessage = i18n.network_error; + } finally { this.loading = false; - }); + } } } }; |