mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 20:42:43 +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
|
||||
- Updated the welcome text
|
||||
- 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
|
||||
- Adding in descriptive note blocks. (Thanks calculuschild!)
|
||||
|
||||
@@ -122,6 +122,12 @@ module.exports = {
|
||||
}),
|
||||
|
||||
both : React.createClass({
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
errorId : null
|
||||
};
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
showDropdown: false,
|
||||
@@ -131,9 +137,26 @@ module.exports = {
|
||||
},
|
||||
|
||||
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({
|
||||
edit : JSON.parse(localStorage.getItem(EDIT_KEY) || '[]'),
|
||||
view : JSON.parse(localStorage.getItem(VIEW_KEY) || '[]')
|
||||
edit : edited,
|
||||
view : viewed
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user