mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-25 01:02:47 +00:00
Add lock result
This commit is contained in:
@@ -50,7 +50,8 @@ const LockBrew = createClass({
|
||||
brewId : '',
|
||||
code : 1000,
|
||||
editMessage : '',
|
||||
shareMessage : ''
|
||||
shareMessage : '',
|
||||
result : {}
|
||||
};
|
||||
},
|
||||
|
||||
@@ -75,7 +76,7 @@ const LockBrew = createClass({
|
||||
.send(newLock)
|
||||
.set('Content-Type', 'application/json')
|
||||
.then((response)=>{
|
||||
console.log(response.body);
|
||||
this.setState({ result: response.body });
|
||||
});
|
||||
},
|
||||
|
||||
@@ -83,6 +84,23 @@ const LockBrew = createClass({
|
||||
return <input type='text' name={name} value={this.state[name]} onChange={(e)=>this.handleChange(e, name)} autoComplete='off' required/>;
|
||||
},
|
||||
|
||||
renderResult : function(){
|
||||
return <>
|
||||
<h3>Result:</h3>
|
||||
<table>
|
||||
<tbody>
|
||||
{Object.keys(this.state.result).map((key, idx)=>{
|
||||
return <tr key={`${idx}-row`}>
|
||||
<td key={`${idx}-key`}>{key}</td>
|
||||
<td key={`${idx}-value`}>{this.state.result[key].toString()}
|
||||
</td>
|
||||
</tr>;
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</>;
|
||||
},
|
||||
|
||||
render : function() {
|
||||
return <div className='lockBrew'>
|
||||
<div className='lockForm'>
|
||||
@@ -112,6 +130,7 @@ const LockBrew = createClass({
|
||||
<input type='submit' />
|
||||
</label>
|
||||
</form>
|
||||
{this.state.result && this.renderResult()}
|
||||
</div>
|
||||
<div className='lockSuggestions'>
|
||||
<h2>Suggestions</h2>
|
||||
|
||||
Reference in New Issue
Block a user