This is an automated email from the ASF dual-hosted git repository.
hsluoyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/casbin-gateway.git
The following commit(s) were added to refs/heads/master by this push:
new 07b058d fix(channel): save before testing connectivity
07b058d is described below
commit 07b058d94636a8a0360d95196331c6157a6d2866
Author: Yang Luo <[email protected]>
AuthorDate: Thu Aug 20 10:01:38 2026 +0800
fix(channel): save before testing connectivity
---
web/src/pages/ChannelEditPage.tsx | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/web/src/pages/ChannelEditPage.tsx
b/web/src/pages/ChannelEditPage.tsx
index 023be18..e4a97f9 100644
--- a/web/src/pages/ChannelEditPage.tsx
+++ b/web/src/pages/ChannelEditPage.tsx
@@ -104,26 +104,35 @@ export default function ChannelEditPage() {
const save = () => {
if (!channel) {
- return;
+ return Promise.resolve(false);
}
- ChannelBackend.updateChannel(owner, channelName, channel)
+ return ChannelBackend.updateChannel(owner, channelName, channel)
.then(res => {
if (res.status === "error") {
Setting.showMessage("error", `${i18next.t("channel:Failed to
save")}: ${res.msg}`);
- return;
+ return false;
}
Setting.showMessage("success", i18next.t("channel:Channel saved"));
+ return true;
})
- .catch(error => Setting.showMessage("error",
`${i18next.t("channel:Failed to save")}: ${error}`));
+ .catch(error => {
+ Setting.showMessage("error", `${i18next.t("channel:Failed to save")}:
${error}`);
+ return false;
+ });
};
+ // The test probes the stored channel, so the edits have to be saved first.
const test = () => {
setTesting(true);
setResult(null);
- ChannelBackend.testChannel(owner, channelName)
+ save()
+ .then(saved => (saved ? ChannelBackend.testChannel(owner, channelName) :
null))
.then(res => {
setTesting(false);
+ if (res === null) {
+ return;
+ }
if (res.status === "error") {
Setting.showMessage("error", `${i18next.t("channel:Failed to
test")}: ${res.msg}`);
return;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]