1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-16 03:45:56 +00:00

new error ahndler nearly done

This commit is contained in:
Scott Tolksdorf
2016-05-19 08:35:37 -04:00
parent e7f1083edb
commit 52ff2e41e6
2 changed files with 45 additions and 8 deletions

View File

@@ -107,7 +107,8 @@ var EditPage = React.createClass({
save : function(){
this.debounceSave.cancel();
this.setState({
isSaving : true
isSaving : true,
errors : null
});
request
@@ -117,17 +118,35 @@ var EditPage = React.createClass({
title : this.state.title
})
.end((err, res) => {
this.savedBrew = res.body;
this.setState({
isPending : false,
isSaving : false,
errors : err,
lastUpdated : res.body.updatedAt
})
if(err){
this.setState({
errors : err,
})
}else{
this.savedBrew = res.body;
this.setState({
isPending : false,
isSaving : false,
lastUpdated : res.body.updatedAt
})
}
})
},
renderSaveButton : function(){
//if(this.state.errors){
return <Nav.item className='save error' icon="fa-warning">
Oops!
<div className='errorContainer'>
Looks like there was a problem saving. <br />
Report the issue <a target='_blank' href={'https://github.com/stolksdorf/naturalcrit/issues/new?body='+
encodeURIComponent(JSON.stringify(this.state.errors, null, ' '))}>
here
</a>.
</div>
</Nav.item>
//}
if(this.state.isSaving){
return <Nav.item className='save' icon="fa-spinner fa-spin">saving...</Nav.item>
}

View File

@@ -7,6 +7,24 @@
color : #666;
cursor : initial;
}
&.error{
position: relative;
background-color: @red;
.errorContainer{
position: absolute;
top: 29px;
background-color: #333;
padding: 8px;
width: 120px;
left: -20px;
z-index: 1000;
a{
color : @teal;
}
}
}
}
}