mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-06 23:02:45 +00:00
Add lock result
This commit is contained in:
@@ -50,7 +50,8 @@ const LockBrew = createClass({
|
|||||||
brewId : '',
|
brewId : '',
|
||||||
code : 1000,
|
code : 1000,
|
||||||
editMessage : '',
|
editMessage : '',
|
||||||
shareMessage : ''
|
shareMessage : '',
|
||||||
|
result : {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -75,7 +76,7 @@ const LockBrew = createClass({
|
|||||||
.send(newLock)
|
.send(newLock)
|
||||||
.set('Content-Type', 'application/json')
|
.set('Content-Type', 'application/json')
|
||||||
.then((response)=>{
|
.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/>;
|
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() {
|
render : function() {
|
||||||
return <div className='lockBrew'>
|
return <div className='lockBrew'>
|
||||||
<div className='lockForm'>
|
<div className='lockForm'>
|
||||||
@@ -112,6 +130,7 @@ const LockBrew = createClass({
|
|||||||
<input type='submit' />
|
<input type='submit' />
|
||||||
</label>
|
</label>
|
||||||
</form>
|
</form>
|
||||||
|
{this.state.result && this.renderResult()}
|
||||||
</div>
|
</div>
|
||||||
<div className='lockSuggestions'>
|
<div className='lockSuggestions'>
|
||||||
<h2>Suggestions</h2>
|
<h2>Suggestions</h2>
|
||||||
|
|||||||
Reference in New Issue
Block a user