diff --git a/src/components/forms/SolutionDetailsForm.js b/src/components/forms/SolutionDetailsForm.js index ea478511ae50ddc7527bdc1b6a6941cff26f2178..f702c516f06ec49d4b7faf30169f683269984929 100644 --- a/src/components/forms/SolutionDetailsForm.js +++ b/src/components/forms/SolutionDetailsForm.js @@ -4,6 +4,9 @@ import { connect } from 'react-redux'; import CorrectSolutionForm from './CorrectSolutionForm'; import { emptyMessage } from '../pages/Homework'; import './Forms.css'; +import { + getSolutions, +} from '../../actions/homework'; class SolutionDetailsForm extends Component { constructor(props) { @@ -45,7 +48,13 @@ class SolutionDetailsForm extends Component { <Modal open={this.state.showModal} trigger={ - <button id='task' onClick={() => { this.setState({ showModal: true }); }}> + <button + id='task' + onClick={() => { + this.setState({ showModal: true }); + this.props.getSolutions(); + }} + > <Icon name='external' /> {this.props.tasktitle} </button> @@ -115,4 +124,5 @@ class SolutionDetailsForm extends Component { const mapStateToProps = ({ homeworks, user }) => ({ homeworks, user }); export default connect(mapStateToProps, { + getSolutions, })(SolutionDetailsForm); diff --git a/src/components/pages/Homework.js b/src/components/pages/Homework.js index 12f8fac4e7d4110d425cc360fd301691f168a555..84b954bda94624cfe9fcd04d7c7336bb1cea7245 100644 --- a/src/components/pages/Homework.js +++ b/src/components/pages/Homework.js @@ -68,8 +68,8 @@ export const emptyMessage = (header, text, marginBottom, warning) => ( class Homework extends Component { componentDidMount() { this.props.getTasks(); - this.props.getSolutions(this.props.user.id); this.props.getProfiles(); + this.props.getSolutions(this.props.user.id); this.props.getDocuments(); } @@ -161,7 +161,11 @@ class Homework extends Component { } > <Table.Cell> - <SolutionDetailsForm taskid={task.id} tasktitle={task.title} taskdesc={task.text} /> + <SolutionDetailsForm + taskid={task.id} + tasktitle={task.title} + taskdesc={task.text} + /> </Table.Cell> <Table.Cell> {moment(task.deadline).format('YYYY. MM. DD. HH:mm')}