mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-11 19:52:41 +00:00
Visitng a deleted brew will now remove it from your recent list
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
- Added in a license file
|
- Added in a license file
|
||||||
- Updated the welcome text
|
- Updated the welcome text
|
||||||
- Added in a much better Error page
|
- Added in a much better Error page
|
||||||
|
- If you visit a deleted brew, it will now remove it from your recent list. (Thanks u/sIllverback!)
|
||||||
|
|
||||||
### Friday, 29/07/2016 - v2.2.7
|
### Friday, 29/07/2016 - v2.2.7
|
||||||
- Adding in descriptive note blocks. (Thanks calculuschild!)
|
- Adding in descriptive note blocks. (Thanks calculuschild!)
|
||||||
|
|||||||
@@ -122,6 +122,12 @@ module.exports = {
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
both : React.createClass({
|
both : React.createClass({
|
||||||
|
getDefaultProps: function() {
|
||||||
|
return {
|
||||||
|
errorId : null
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
return {
|
||||||
showDropdown: false,
|
showDropdown: false,
|
||||||
@@ -131,9 +137,26 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
|
|
||||||
|
var edited = JSON.parse(localStorage.getItem(EDIT_KEY) || '[]');
|
||||||
|
var viewed = JSON.parse(localStorage.getItem(VIEW_KEY) || '[]');
|
||||||
|
|
||||||
|
if(this.props.errorId){
|
||||||
|
edited = _.filter(edited, (edit) => {
|
||||||
|
return edit.id !== this.props.errorId;
|
||||||
|
});
|
||||||
|
viewed = _.filter(viewed, (view) => {
|
||||||
|
return view.id !== this.props.errorId;
|
||||||
|
});
|
||||||
|
|
||||||
|
localStorage.setItem(EDIT_KEY, JSON.stringify(edited));
|
||||||
|
localStorage.setItem(VIEW_KEY, JSON.stringify(viewed));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
edit : JSON.parse(localStorage.getItem(EDIT_KEY) || '[]'),
|
edit : edited,
|
||||||
view : JSON.parse(localStorage.getItem(VIEW_KEY) || '[]')
|
view : viewed
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user