0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-02 06:22:43 +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(){ componentDidMount : function(){
if(!this.state.saveLocation && this.props.uiItems.username) { if(!this.state.saveLocation && this.props.uiItems.username) {
SAVEKEY = `HOMEBREWERY-DEFAULT-SAVE-LOCATION-${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 == '') { if(saveLocation == '') {
// TO DO: Implement logic to determine the appropriate location given current state saveLocation = 'HOMEBREWERY';
console.log(this.state.uiItems); if(this.state.uiItems.googleId) {
saveLocation = 'GOOGLE-DRIVE';
}
}; };
this.setState({ this.setState({
saveLocation : saveLocation saveLocation : saveLocation