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
Branches
Tags
No related merge requests found
...@@ -45,13 +45,14 @@ export const getSolutions = taskId => ( ...@@ -45,13 +45,14 @@ export const getSolutions = taskId => (
} }
); );
export const addTask = ({ title, text, deadline }) => ( export const addTask = ({ title, text, deadline, bits }) => (
async (dispatch) => { async (dispatch) => {
try { try {
const response = await axios.post('/api/v1/homework/tasks/', { const response = await axios.post('/api/v1/homework/tasks/', {
title, title,
text, text,
deadline, deadline,
bits,
}); });
if (response.data.id) { if (response.data.id) {
dispatch({ dispatch({
......
...@@ -14,7 +14,7 @@ class AddTaskForm extends Component { ...@@ -14,7 +14,7 @@ class AddTaskForm extends Component {
} }
render() { render() {
const { title, text, deadline } = this.props.newTask; const { title, text, deadline, bits = 1 } = this.props.newTask;
return ( return (
<Modal <Modal
open={this.state.showModal} open={this.state.showModal}
...@@ -62,6 +62,15 @@ class AddTaskForm extends Component { ...@@ -62,6 +62,15 @@ class AddTaskForm extends Component {
}} }}
value={deadline} 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> </Form>
</Modal.Content> </Modal.Content>
<Modal.Actions> <Modal.Actions>
...@@ -85,7 +94,7 @@ class AddTaskForm extends Component { ...@@ -85,7 +94,7 @@ class AddTaskForm extends Component {
deadline === '' || moment().isAfter(deadline) deadline === '' || moment().isAfter(deadline)
} }
onClick={() => { onClick={() => {
this.props.addTask({ title, text, deadline }); this.props.addTask({ title, text, deadline, bits });
this.setState({ showModal: false }); this.setState({ showModal: false });
this.props.clearWrite(); this.props.clearWrite();
}} }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment