Skip to content
Snippets Groups Projects
Commit 3f04c1eb authored by Rafael László's avatar Rafael László :speech_balloon:
Browse files

admin create Task with bits

parent 2609236d
No related branches found
No related tags found
No related merge requests found
......@@ -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({
......
......@@ -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();
}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment