Skip to content

Commit

Permalink
Add better defaults for first time users
Browse files Browse the repository at this point in the history
  • Loading branch information
danesparza committed Oct 20, 2017
1 parent 49b2fb1 commit 5adf6af
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/stores/SettingsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,20 @@ class SettingsStore extends Store {
switch (action.actionType) {
case ActionTypes.RECEIVE_SERVER_LIST:

this.serverList = action.servers;
console.log(action);
this.serverList = action.servers || [];
console.log("Server list", this.serverList);

// If this list is now blank, we should reset
// current database
// list of databases
// current server
if(this.serverList.length < 1){
this.currentDatabase = "";
this.currentServerDBList = [];
this.currentServer = {};
}
try{
if(this.serverList.length < 1){
this.currentDatabase = "";
this.currentServerDBList = [];
this.currentServer = {};
}
} catch(e) { /* No op */}

this.__emitChange();
break;
Expand All @@ -112,15 +114,15 @@ class SettingsStore extends Store {
});
} catch(e) { /* No op */ }

console.log(action);
console.log("Current server: ", this.getCurrentServer());

this.__emitChange();
break;

case ActionTypes.RECEIVE_CURRENT_DATABASE:

this.currentDatabase = action.database;
console.log(action);
console.log("Current database: ", this.currentDatabase);

this.__emitChange();
break;
Expand Down

0 comments on commit 5adf6af

Please sign in to comment.