-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Hayden Woolstenhulme
authored and
Hayden Woolstenhulme
committed
Jun 12, 2018
1 parent
aa539f3
commit e016e54
Showing
9 changed files
with
240 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
delete from journal where id = $1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
UPDATE journal | ||
SET message = $1 | ||
WHERE id = $2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
select id, message from journal | ||
select id, message from journal where emid = $1 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
import { connect } from "react-redux"; | ||
import { selectEntry } from "../../ducks/users"; | ||
|
||
|
||
class Checkbox extends Component { | ||
constructor() { | ||
super(); | ||
|
||
this.state = { | ||
isChecked: false, | ||
entryToDelete: [] | ||
}; | ||
this.toggleCheckboxChange = this.toggleCheckboxChange.bind(this); | ||
} | ||
|
||
toggleCheckboxChange = () => { | ||
const { handleCheckboxChange, label } = this.props; | ||
console.log(this.props) | ||
|
||
this.setState({ isChecked: !this.state.isChecked, entryToDelete: label }); | ||
this.props.selectEntry(label) | ||
console.log(this.state.entryToDelete) | ||
}; | ||
|
||
render() { | ||
const { label } = this.props; | ||
const { isChecked } = this.state; | ||
|
||
return ( | ||
<div className="checkbox"> | ||
<label> | ||
<input | ||
type="checkbox" | ||
value={label} | ||
checked={isChecked} | ||
onChange={this.toggleCheckboxChange} | ||
/> | ||
|
||
{label} | ||
</label> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
Checkbox.PropTypes = { | ||
label: PropTypes.string.isRequired, | ||
handleCheckboxChange: PropTypes.func.isRequired | ||
}; | ||
|
||
function mapStateToProps(state) { | ||
return { | ||
entryToDelete: state.entryToDelete | ||
}; | ||
} | ||
|
||
export default connect( | ||
mapStateToProps, | ||
{ selectEntry } | ||
)(Checkbox); |
Oops, something went wrong.