2
0
Эх сурвалжийг харах

add try-catch and translation

zahmis 4 жил өмнө
parent
commit
ea0da72fc3

+ 2 - 0
resource/locales/en_US/admin/admin.json

@@ -274,6 +274,8 @@
       "impossible": "Impossible"
     },
     "bot_reset_successful": "Bot settings have been reset.",
+    "bot_all_reset_successful": "Reset all bot settings.",
+
     "copied_to_clipboard": "Copied to clipboard",
     "set_scope": "Please set up Bot Token Scopes from Slack settings",
     "modal": {

+ 1 - 0
resource/locales/ja_JP/admin/admin.json

@@ -272,6 +272,7 @@
       "impossible": "不可"
     },
     "bot_reset_successful": "Botの設定を消去しました。",
+    "bot_all_reset_successful": "全ての Bot の設定を消去しました。",
     "copied_to_clipboard": "クリップボードにコピーされました。",
     "set_scope": "Slackの設定画面からBot Token Scopeを設定してください",
     "modal": {

+ 1 - 0
resource/locales/zh_CN/admin/admin.json

@@ -282,6 +282,7 @@
       "impossible": "不可能"
     },
     "bot_reset_successful": "删除了BOT设置。",
+    "bot_all_reset_successful": "所有的 Bot 设置都被清除了。",
     "copied_to_clipboard": "它已复制到剪贴板。",
     "set_scope": "在Slack设置页面中配置Bot Token Scope。",
     "modal": {

+ 8 - 2
src/client/js/components/Admin/SlackIntegration/SlackIntegration.jsx

@@ -52,8 +52,14 @@ const SlackIntegration = (props) => {
   }, [appContainer.apiv3]);
 
   const resetAllSettings = async() => {
-    await appContainer.apiv3.delete('/slack-integration-settings/bot-type');
-    return toastSuccess('成功');
+    try {
+      await appContainer.apiv3.delete('/slack-integration-settings/bot-type');
+      fetchSlackIntegrationData();
+      toastSuccess(t('admin:slack_integration.bot_all_reset_successful'));
+    }
+    catch (error) {
+      toastError(error);
+    }
   };
 
   const resetWithOutSettings = async() => {