diff --git a/src/actions/homework.js b/src/actions/homework.js index 729899ec6dd5a83a370073781d6b659a750c41ff..3d24ed57879ce1c32b96e42c0f032e444f9c8887 100644 --- a/src/actions/homework.js +++ b/src/actions/homework.js @@ -45,13 +45,14 @@ export const getSolutions = taskId => ( } ); -export const addTask = ({ title, text, deadline }) => ( +export const addTask = ({ title, text, deadline, bits }) => ( async (dispatch) => { try { const response = await axios.post('/api/v1/homework/tasks/', { title, text, deadline, + bits, }); if (response.data.id) { dispatch({ diff --git a/src/components/forms/AddTaskForm.js b/src/components/forms/AddTaskForm.js index 6b386a732d95a39098334cadb747e12a57310341..46f74bbb9939cd2aac2dad4592233a094eec542f 100644 --- a/src/components/forms/AddTaskForm.js +++ b/src/components/forms/AddTaskForm.js @@ -14,7 +14,7 @@ class AddTaskForm extends Component { } render() { - const { title, text, deadline } = this.props.newTask; + const { title, text, deadline, bits = 1 } = this.props.newTask; return ( <Modal open={this.state.showModal} @@ -62,6 +62,15 @@ class AddTaskForm extends Component { }} value={deadline} /> + <Form.Field + control={Input} + type='number' + label='Bitek szĂĄma:' + name='bits' + onChange={e => this.props.writeTask(e)} + value={bits} + placeholder='Add meg a feladatĂŠrt kaphatĂł bitek szĂĄmĂĄt ...' + /> </Form> </Modal.Content> <Modal.Actions> @@ -85,7 +94,7 @@ class AddTaskForm extends Component { deadline === '' || moment().isAfter(deadline) } onClick={() => { - this.props.addTask({ title, text, deadline }); + this.props.addTask({ title, text, deadline, bits }); this.setState({ showModal: false }); this.props.clearWrite(); }}