|
@@ -78,10 +78,10 @@ const SlackIntegration = (props) => {
|
|
|
fetchSlackIntegrationData();
|
|
fetchSlackIntegrationData();
|
|
|
}, [fetchSlackIntegrationData]);
|
|
}, [fetchSlackIntegrationData]);
|
|
|
|
|
|
|
|
- const changeCurrentBotSettings = async() => {
|
|
|
|
|
|
|
+ const changeCurrentBotSettings = async(clickedBotType) => {
|
|
|
try {
|
|
try {
|
|
|
const res = await appContainer.apiv3.put('/slack-integration-settings/bot-type', {
|
|
const res = await appContainer.apiv3.put('/slack-integration-settings/bot-type', {
|
|
|
- currentBotType: selectedBotType,
|
|
|
|
|
|
|
+ currentBotType: selectedBotType || clickedBotType,
|
|
|
});
|
|
});
|
|
|
setCurrentBotType(res.data.slackBotTypeParam.slackBotType);
|
|
setCurrentBotType(res.data.slackBotTypeParam.slackBotType);
|
|
|
setSelectedBotType(null);
|
|
setSelectedBotType(null);
|
|
@@ -90,7 +90,6 @@ const SlackIntegration = (props) => {
|
|
|
setSlackBotToken(null);
|
|
setSlackBotToken(null);
|
|
|
setIsSendTestMessage(false);
|
|
setIsSendTestMessage(false);
|
|
|
setSlackWSNameInWithoutProxy(null);
|
|
setSlackWSNameInWithoutProxy(null);
|
|
|
- toastSuccess(t('admin:slack_integration.bot_reset_successful'));
|
|
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
toastError(err);
|
|
toastError(err);
|
|
@@ -101,22 +100,15 @@ const SlackIntegration = (props) => {
|
|
|
if (clickedBotType === currentBotType) {
|
|
if (clickedBotType === currentBotType) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if (currentBotType === null) {
|
|
|
|
|
- try {
|
|
|
|
|
- await appContainer.apiv3.put('/slack-integration-settings/bot-type', {
|
|
|
|
|
- currentBotType: clickedBotType,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- catch (error) {
|
|
|
|
|
- toastError(error);
|
|
|
|
|
- }
|
|
|
|
|
- return setCurrentBotType(clickedBotType);
|
|
|
|
|
|
|
+ if (currentBotType == null) {
|
|
|
|
|
+ return changeCurrentBotSettings(clickedBotType);
|
|
|
}
|
|
}
|
|
|
setSelectedBotType(clickedBotType);
|
|
setSelectedBotType(clickedBotType);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const changeCurrentBotSettingsHandler = async() => {
|
|
const changeCurrentBotSettingsHandler = async() => {
|
|
|
changeCurrentBotSettings();
|
|
changeCurrentBotSettings();
|
|
|
|
|
+ toastSuccess(t('admin:slack_integration.bot_reset_successful'));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const cancelBotChangeHandler = () => {
|
|
const cancelBotChangeHandler = () => {
|