0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-13 17:22:49 +00:00

New brew search finished on admin page

This commit is contained in:
Scott Tolksdorf
2017-01-28 16:35:48 -05:00
parent 7e6f42f062
commit 6030134de2
15 changed files with 117 additions and 396 deletions

View File

@@ -9,7 +9,7 @@ const BrewTable = require('../brewTable/brewTable.jsx');
const InvalidBrew = React.createClass({
getDefaultProps: function() {
return {
adminKey : '',
};
},
getInitialState: function() {
@@ -19,7 +19,7 @@ const InvalidBrew = React.createClass({
},
getInvalid : function(){
request.get(`/admin/invalid`)
.query({ admin_key : this.props.adminKey })
.set('x-homebrew-admin', this.props.adminKey)
.end((err, res) => {
this.setState({
brews : res.body
@@ -32,7 +32,7 @@ const InvalidBrew = React.createClass({
if(!confirm('Sure you are sure?')) return;
request.delete(`/admin/invalid`)
.query({ admin_key : this.props.adminKey })
.set('x-homebrew-admin', this.props.adminKey)
.end((err, res) => {
console.log(err, res.body);
alert('Invalid brews removed!');
@@ -42,9 +42,9 @@ const InvalidBrew = React.createClass({
render: function(){
return <div className='invalidBrew'>
<h1>Remove Invalid Brews</h1>
This will removes all brews older than 3 days and shorter than a tweet.
<div>This will removes all brews older than 3 days and shorter than a tweet.</div>
<button className='get' onClick={this.getInvalid}> Get Invalid Brews</button>
<button className='remove' onClick={this.removeInvalid}> Remove invalid Brews</button>
<button className='remove' disabled={this.state.brews.length == 0} onClick={this.removeInvalid}> Remove invalid Brews</button>
<BrewTable brews={this.state.brews} />
</div>