diff --git a/ui/src/actions/GlobalAction.ts b/ui/src/actions/GlobalAction.ts deleted file mode 100644 index f60df32..0000000 --- a/ui/src/actions/GlobalAction.ts +++ /dev/null @@ -1,19 +0,0 @@ -import {AxiosResponse} from 'axios'; -import dispatcher from '../stores/dispatcher'; -import * as AppAction from './AppAction'; -import * as ClientAction from './ClientAction'; -import * as MessageAction from './MessageAction'; -import * as UserAction from './UserAction'; - -export function initialLoad(resp: AxiosResponse) { - AppAction.fetchApps(); - MessageAction.listenToWebSocket(); - ClientAction.fetchClients(); - if (resp.data.admin) { - UserAction.fetchUsers(); - } -} - -export function snack(message: string) { - dispatcher.dispatch({type: 'SNACK', payload: message}); -} diff --git a/ui/src/stores/CurrentUser.ts b/ui/src/stores/CurrentUser.ts index 05e378f..9b8a96e 100644 --- a/ui/src/stores/CurrentUser.ts +++ b/ui/src/stores/CurrentUser.ts @@ -1,7 +1,6 @@ import axios, {AxiosResponse} from 'axios'; import * as config from '../config'; import {detect} from 'detect-browser'; -import * as GlobalAction from '../actions/GlobalAction'; import SnackManager, {SnackReporter} from './SnackManager'; import {observable} from 'mobx'; @@ -38,6 +37,7 @@ class CurrentUser { }; public login = async (username: string, password: string) => { + this.loggedIn = false; this.authenticating = true; const browser = detect(); const name = (browser && browser.name + ' ' + browser.version) || 'unknown browser'; @@ -53,10 +53,9 @@ class CurrentUser { this.snack(`A client named '${name}' was created for your session.`); this.setToken(resp.data.token); this.tryAuthenticate() - .then((user) => { + .then(() => { this.authenticating = false; this.loggedIn = true; - GlobalAction.initialLoad(user); }) .catch(() => { this.authenticating = false;