feat: fix showing wrong error messages (#1385)

This commit is contained in:
Yaodong Yu
2022-12-09 15:11:13 +08:00
committed by GitHub
parent e705eecffe
commit b41d8652f0
11 changed files with 48 additions and 19 deletions

View File

@ -224,7 +224,7 @@ class App extends Component {
this.setLanguage(account);
} else {
if (res.data !== "Please login first") {
Setting.showMessage("error", `Failed to sign in: ${res.msg}`);
Setting.showMessage("error", `${i18next.t("application:Failed to sign in")}: ${res.msg}`);
}
}
@ -249,7 +249,7 @@ class App extends Component {
account: null,
});
Setting.showMessage("success", "Logged out successfully");
Setting.showMessage("success", i18next.t("application:Logged out successfully"));
const redirectUri = res.data2;
if (redirectUri !== null && redirectUri !== undefined && redirectUri !== "") {
Setting.goToLink(redirectUri);

View File

@ -293,7 +293,7 @@ class LoginPage extends React.Component {
const responseType = values["type"];
if (responseType === "login") {
Setting.showMessage("success", "Logged in successfully");
Setting.showMessage("success", i18next.t("application:Logged in successfully"));
const link = Setting.getFromLink();
Setting.goToLink(link);

View File

@ -92,6 +92,7 @@ class PolicyTable extends React.Component {
.then((res) => {
if (res.status === "ok") {
this.setState({policyLists: res.data});
Setting.showMessage("success", i18next.t("adapter:Sync policies successfully"));
} else {
Setting.showMessage("error", `${i18next.t("adapter:Failed to sync policies")}: ${res.msg}`);
}
@ -293,7 +294,7 @@ class PolicyTable extends React.Component {
render() {
return (<>
<Button type="primary" onClick={() => {this.synPolicies();}}>
<Button type="primary" disabled={this.state.editingIndex !== ""} onClick={() => {this.synPolicies();}}>
{i18next.t("adapter:Sync")}
</Button>
{

View File

@ -7,12 +7,13 @@
},
"adapter": {
"Edit Adapter": "Edit Adapter",
"Failed to sync policies: ": "Failed to sync policies: ",
"Failed to sync policies": "Failed to sync policies",
"New Adapter": "New Adapter",
"Policies": "Policies",
"Policies - Tooltip": "Policies - Tooltip",
"Repeated policy rules": "Repeated policy rules",
"Sync": "Sync"
"Sync": "Sync",
"Sync policies successfully": "Sync policies successfully"
},
"application": {
"Always": "Always",
@ -36,6 +37,7 @@
"Enable signin session - Tooltip": "Aktiviere Anmeldesession - Tooltip",
"Enable signup": "Anmeldung aktivieren",
"Enable signup - Tooltip": "Whether to allow users to sign up",
"Failed to sign in": "Failed to sign in",
"File uploaded successfully": "Datei erfolgreich hochgeladen",
"Form CSS": "Form CSS",
"Form CSS - Edit": "Form CSS - Edit",
@ -45,6 +47,8 @@
"Grant types": "Grant types",
"Grant types - Tooltip": "Grant types - Tooltip",
"Left": "Left",
"Logged in successfully": "Logged in successfully",
"Logged out successfully": "Logged out successfully",
"New Application": "New Application",
"None": "None",
"Password ON": "Passwort AN",

View File

@ -7,12 +7,13 @@
},
"adapter": {
"Edit Adapter": "Edit Adapter",
"Failed to sync policies: ": "Failed to sync policies: ",
"Failed to sync policies": "Failed to sync policies",
"New Adapter": "New Adapter",
"Policies": "Policies",
"Policies - Tooltip": "Policies - Tooltip",
"Repeated policy rules": "Repeated policy rules",
"Sync": "Sync"
"Sync": "Sync",
"Sync policies successfully": "Sync policies successfully"
},
"application": {
"Always": "Always",
@ -36,6 +37,7 @@
"Enable signin session - Tooltip": "Enable signin session - Tooltip",
"Enable signup": "Enable signup",
"Enable signup - Tooltip": "Enable signup - Tooltip",
"Failed to sign in": "Failed to sign in",
"File uploaded successfully": "File uploaded successfully",
"Form CSS": "Form CSS",
"Form CSS - Edit": "Form CSS - Edit",
@ -45,6 +47,8 @@
"Grant types": "Grant types",
"Grant types - Tooltip": "Grant types - Tooltip",
"Left": "Left",
"Logged in successfully": "Logged in successfully",
"Logged out successfully": "Logged out successfully",
"New Application": "New Application",
"None": "None",
"Password ON": "Password ON",

View File

@ -7,12 +7,13 @@
},
"adapter": {
"Edit Adapter": "Edit Adapter",
"Failed to sync policies: ": "Failed to sync policies: ",
"Failed to sync policies": "Failed to sync policies",
"New Adapter": "New Adapter",
"Policies": "Policies",
"Policies - Tooltip": "Policies - Tooltip",
"Repeated policy rules": "Repeated policy rules",
"Sync": "Sync"
"Sync": "Sync",
"Sync policies successfully": "Sync policies successfully"
},
"application": {
"Always": "Always",
@ -36,6 +37,7 @@
"Enable signin session - Tooltip": "Activer la session de connexion - infobulle",
"Enable signup": "Activer l'inscription",
"Enable signup - Tooltip": "Whether to allow users to sign up",
"Failed to sign in": "Failed to sign in",
"File uploaded successfully": "Fichier téléchargé avec succès",
"Form CSS": "Form CSS",
"Form CSS - Edit": "Form CSS - Edit",
@ -45,6 +47,8 @@
"Grant types": "Grant types",
"Grant types - Tooltip": "Grant types - Tooltip",
"Left": "Left",
"Logged in successfully": "Logged in successfully",
"Logged out successfully": "Logged out successfully",
"New Application": "New Application",
"None": "None",
"Password ON": "Mot de passe activé",

View File

@ -7,12 +7,13 @@
},
"adapter": {
"Edit Adapter": "Edit Adapter",
"Failed to sync policies: ": "Failed to sync policies: ",
"Failed to sync policies": "Failed to sync policies",
"New Adapter": "New Adapter",
"Policies": "Policies",
"Policies - Tooltip": "Policies - Tooltip",
"Repeated policy rules": "Repeated policy rules",
"Sync": "Sync"
"Sync": "Sync",
"Sync policies successfully": "Sync policies successfully"
},
"application": {
"Always": "Always",
@ -36,6 +37,7 @@
"Enable signin session - Tooltip": "Enable signin session - Tooltip",
"Enable signup": "サインアップを有効にする",
"Enable signup - Tooltip": "Whether to allow users to sign up",
"Failed to sign in": "Failed to sign in",
"File uploaded successfully": "ファイルが正常にアップロードされました",
"Form CSS": "Form CSS",
"Form CSS - Edit": "Form CSS - Edit",
@ -45,6 +47,8 @@
"Grant types": "Grant types",
"Grant types - Tooltip": "Grant types - Tooltip",
"Left": "Left",
"Logged in successfully": "Logged in successfully",
"Logged out successfully": "Logged out successfully",
"New Application": "New Application",
"None": "None",
"Password ON": "パスワードON",

View File

@ -7,12 +7,13 @@
},
"adapter": {
"Edit Adapter": "Edit Adapter",
"Failed to sync policies: ": "Failed to sync policies: ",
"Failed to sync policies": "Failed to sync policies",
"New Adapter": "New Adapter",
"Policies": "Policies",
"Policies - Tooltip": "Policies - Tooltip",
"Repeated policy rules": "Repeated policy rules",
"Sync": "Sync"
"Sync": "Sync",
"Sync policies successfully": "Sync policies successfully"
},
"application": {
"Always": "Always",
@ -36,6 +37,7 @@
"Enable signin session - Tooltip": "Enable signin session - Tooltip",
"Enable signup": "Enable signup",
"Enable signup - Tooltip": "Whether to allow users to sign up",
"Failed to sign in": "Failed to sign in",
"File uploaded successfully": "File uploaded successfully",
"Form CSS": "Form CSS",
"Form CSS - Edit": "Form CSS - Edit",
@ -45,6 +47,8 @@
"Grant types": "Grant types",
"Grant types - Tooltip": "Grant types - Tooltip",
"Left": "Left",
"Logged in successfully": "Logged in successfully",
"Logged out successfully": "Logged out successfully",
"New Application": "New Application",
"None": "None",
"Password ON": "Password ON",

View File

@ -7,12 +7,13 @@
},
"adapter": {
"Edit Adapter": "Edit Adapter",
"Failed to sync policies: ": "Failed to sync policies: ",
"Failed to sync policies": "Failed to sync policies",
"New Adapter": "New Adapter",
"Policies": "Policies",
"Policies - Tooltip": "Policies - Tooltip",
"Repeated policy rules": "Repeated policy rules",
"Sync": "Sync"
"Sync": "Sync",
"Sync policies successfully": "Sync policies successfully"
},
"application": {
"Always": "Always",
@ -36,6 +37,7 @@
"Enable signin session - Tooltip": "Включить сеанс входа - Подсказка",
"Enable signup": "Включить регистрацию",
"Enable signup - Tooltip": "Whether to allow users to sign up",
"Failed to sign in": "Failed to sign in",
"File uploaded successfully": "Файл успешно загружен",
"Form CSS": "Form CSS",
"Form CSS - Edit": "Form CSS - Edit",
@ -45,6 +47,8 @@
"Grant types": "Виды грантов",
"Grant types - Tooltip": "Виды грантов - Подсказка",
"Left": "Left",
"Logged in successfully": "Logged in successfully",
"Logged out successfully": "Logged out successfully",
"New Application": "Новое приложение",
"None": "None",
"Password ON": "Пароль ВКЛ",

View File

@ -7,12 +7,13 @@
},
"adapter": {
"Edit Adapter": "编辑适配器",
"Failed to sync policies: ": "同步策略失败: ",
"Failed to sync policies": "同步策略失败",
"New Adapter": "添加适配器",
"Policies": "策略",
"Policies - Tooltip": "策略",
"Repeated policy rules": "重复的策略",
"Sync": "同步"
"Sync": "同步",
"Sync policies successfully": "同步策略成功"
},
"application": {
"Always": "始终开启",
@ -36,6 +37,7 @@
"Enable signin session - Tooltip": "从应用登录Casdoor后Casdoor是否保持会话",
"Enable signup": "启用注册",
"Enable signup - Tooltip": "是否允许用户注册",
"Failed to sign in": "登录失败",
"File uploaded successfully": "文件上传成功",
"Form CSS": "表单CSS",
"Form CSS - Edit": "编辑表单CSS",
@ -45,6 +47,8 @@
"Grant types": "OAuth授权类型",
"Grant types - Tooltip": "选择允许哪些OAuth协议中的Grant types",
"Left": "居左",
"Logged in successfully": "登录成功",
"Logged out successfully": "登出成功",
"New Application": "添加应用",
"None": "关闭",
"Password ON": "开启密码",