import React from 'react';
import axios from 'axios';
import MessageSetting from './MessageSetting.jsx';
import ModuleSettings from '../common/ModuleSettings.jsx';
import SettingCheckbox from '../common/SettingCheckbox.jsx';
import RichSettingSelect from '../common/RichSettingSelect.jsx';
import Variables from '../common/Variables.jsx';
import Loader from './../common/Loader.jsx';
export default class Announcements extends ModuleSettings {
constructor(props) {
super(props);
this.state = {
announcements: {},
channels: [],
isLoading: true,
};
}
async componentWillMount() {
try {
let response = await axios.get(`/api/modules/${this.props.match.params.id}/announcements`);
this.setState({
announcements: response.data.announcements,
channels: response.data.channels,
isLoading: false,
});
} catch (e) {
this.setState({ error: 'Failed to get data, try again later' });
}
}
handleChannel = (selectedOption) => {
let announcements = this.state.announcements;
announcements.channel = selectedOption.value || false;
this.setState({ announcements });
}
render() {
if (this.state.isLoading) {
return
You can use these variables in the message boxes below.