Steven Fukase 5 лет назад
Родитель
Сommit
91123f044d

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

@@ -7,13 +7,13 @@ const AccessTokenSettings = (props) => {
   const { t } = useTranslation('admin');
 
   const discardTokenHandler = () => {
-    if (props.discardTokenHandler != null) {
+    if (props.discardTokenHandler) {
       props.discardTokenHandler();
     }
   };
 
   const generateTokenHandler = () => {
-    if (props.generateTokenHandler != null) {
+    if (props.generateTokenHandler) {
       props.generateTokenHandler();
     }
   };

+ 3 - 0
src/client/js/components/Admin/SlackIntegration/SlackIntegration.jsx

@@ -75,6 +75,9 @@ const SlackIntegration = (props) => {
   };
 
   const discardTokenHandler = async() => {
+    if (!accessToken) {
+      return;
+    }
     try {
       const res = await appContainer.apiv3.put('slack-integration/access-token', { deleteAccessToken: true });
       setAccessToken(res.data.accessToken);