blob: 89771ad66e5648e7fa3558258b8d7235900d706c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
import { h, Component } from 'preact'
import { Link } from 'react-router-dom'
import client from '../../client.js'
export default class TaskForm extends Component {
constructor(props) {
super()
this.state = {
name: '',
}
this.updateState = this.updateState.bind(this)
this.handleSubmit = this.handleSubmit.bind(this)
}
updateState(event){
const name = event.target.name
let value = event.target.value
console.log(name, value)
this.setState({
[name]: value,
error: null,
})
}
updateAlpha(event){
const name = event.target.name
let value = event.target.value
console.log(name, value)
this.setState({
alphaValue: value,
alpha: '1e' + value,
error: null,
})
}
handleSubmit(event) {
event.preventDefault()
let rec = Object.assign({}, this.state)
delete rec.error
this.props.onClose()
client.folder.create( rec ).then( (data) => {
this.props.addFolder( data )
})
}
render() {
return ( <TaskFormView currentTask={this.state} /> )
}
}
|