0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-25 03:12:40 +00:00

Determine default state and set in local storage

This commit is contained in:
G.Ambatte
2023-07-19 20:36:55 +12:00
parent 9e7e646296
commit 64a361e06c

View File

@@ -34,10 +34,12 @@ const AccountPage = createClass({
componentDidMount : function(){
if(!this.state.saveLocation && this.props.uiItems.username) {
SAVEKEY = `HOMEBREWERY-DEFAULT-SAVE-LOCATION-${this.props.uiItems.username}`;
const saveLocation = window.localStorage.getItem(SAVEKEY) || '';
let saveLocation = window.localStorage.getItem(SAVEKEY) || '';
if(saveLocation == '') {
// TO DO: Implement logic to determine the appropriate location given current state
console.log(this.state.uiItems);
saveLocation = 'HOMEBREWERY';
if(this.state.uiItems.googleId) {
saveLocation = 'GOOGLE-DRIVE';
}
};
this.setState({
saveLocation : saveLocation