import { useTranslation } from 'react-i18next';
import toastr from 'toastr';
+import ChatSettingsForm from './ChatSettingsForm';
import ChannelSelect from '../common/ChannelSelect';
import ToggleSwitch from '../common/ToggleSwitch';
}
}, [channel, t]);
+ const saveChatSettings = React.useCallback(async (values) => {
+ try {
+ const rsp = await axios.post(`/api/channels/${channel.id}/chat-settings`, values);
+ setChannel(rsp.data);
+ toastr.success(t('twitchBot.saveSuccess'));
+ } catch (e) {
+ toastr.error(t('twitchBot.saveError'));
+ }
+ }, [channel, t]);
+
return <>
<Row className="mb-4">
<Form.Group as={Col} md={6}>
</Button>
</div>
</Form.Group>
+ <Col md={6}>
+ <h3>{t('twitchBot.chatSettings')}</h3>
+ <ChatSettingsForm channel={channel} onSubmit={saveChatSettings} />
+ </Col>
</Row>
:
<Alert variant="info">