diff --git a/frontend/app/components/shared/SharePopup/SharePopup.js b/frontend/app/components/shared/SharePopup/SharePopup.js index 05229acf5..fc379deb7 100644 --- a/frontend/app/components/shared/SharePopup/SharePopup.js +++ b/frontend/app/components/shared/SharePopup/SharePopup.js @@ -3,13 +3,14 @@ import { connect } from 'react-redux'; import { toast } from 'react-toastify'; import { connectPlayer } from 'Player' import withRequest from 'HOCs/withRequest'; -import { Popup, Dropdown, Icon, Button } from 'UI'; +import { Icon, Button } from 'UI'; import styles from './sharePopup.module.css'; import IntegrateSlackButton from '../IntegrateSlackButton/IntegrateSlackButton'; import SessionCopyLink from './SessionCopyLink'; import Select from 'Shared/Select'; import { Tooltip } from 'react-tippy'; import cn from 'classnames'; +import { fetchList, init } from 'Duck/integrations/slack'; @connectPlayer(state => ({ time: state.time, @@ -17,7 +18,7 @@ import cn from 'classnames'; @connect(state => ({ channels: state.getIn([ 'slack', 'list' ]), tenantId: state.getIn([ 'user', 'account', 'tenantId' ]), -})) +}), { fetchList }) @withRequest({ endpoint: ({ id, entity }, integrationId) => `/integrations/slack/notify/${ integrationId }/${entity}/${ id }`, @@ -30,6 +31,12 @@ export default class SharePopup extends React.PureComponent { channelId: this.props.channels.getIn([ 0, 'webhookId' ]), } + componentDidMount() { + if (this.props.channels.size === 0) { + this.props.fetchList(); + } + } + editMessage = e => this.setState({ comment: e.target.value }) share = () => this.props.request({ comment: this.state.comment }, this.state.channelId) .then(this.handleSuccess)