aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-08-23 15:25:13 +0800
committerGitHub <noreply@github.com>2023-08-23 07:25:13 +0000
commita428591f6b86d4ece21292712a9a5491266303eb (patch)
tree1e54cd5c04c0aa1929baad915becf308917d070c /web_src/js/features
parente4b2bdfbc0a28dcb4272de923b547a19131abd22 (diff)
downloadgitea-a428591f6b86d4ece21292712a9a5491266303eb.tar.gz
gitea-a428591f6b86d4ece21292712a9a5491266303eb.zip
Refactor toast module (#26677)
1. Do not use "async" 2. Call `hideToast` instead of `removeElement` for manual closing
Diffstat (limited to 'web_src/js/features')
-rw-r--r--web_src/js/features/common-global.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js
index 7291410c1a..d02a82a2ef 100644
--- a/web_src/js/features/common-global.js
+++ b/web_src/js/features/common-global.js
@@ -95,14 +95,14 @@ async function fetchActionDoRequest(actionElem, url, opt) {
const data = await resp.json();
// the code was quite messy, sometimes the backend uses "err", sometimes it uses "error", and even "user_error"
// but at the moment, as a new approach, we only use "errorMessage" here, backend can use JSONError() to respond.
- await showErrorToast(data.errorMessage || `server error: ${resp.status}`);
+ showErrorToast(data.errorMessage || `server error: ${resp.status}`);
} else {
- await showErrorToast(`server error: ${resp.status}`);
+ showErrorToast(`server error: ${resp.status}`);
}
} catch (e) {
console.error('error when doRequest', e);
actionElem.classList.remove('is-loading', 'small-loading-icon');
- await showErrorToast(i18n.network_error);
+ showErrorToast(i18n.network_error);
}
}