Skip to content

Commit

Permalink
fixxed auto account login
Browse files Browse the repository at this point in the history
  • Loading branch information
tribbedev committed Aug 10, 2021
1 parent 788e311 commit 15cafbe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/app/desktop/DesktopRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function DesktopRoot({ store }) {
});
}

if (process.env.NODE_ENV === 'development' && currentAccount) {
if (process.env.NODE_ENV !== 'development' && currentAccount) {
dispatch(received(features.mcAuthentication));
dispatch(push('/home'));
} else if (currentAccount) {
Expand All @@ -123,13 +123,13 @@ function DesktopRoot({ store }) {
dispatch(() => {
switch (currentAccount.accountType) {
case ACCOUNT_MICROSOFT:
loginWithOAuthAccessToken();
dispatch(loginWithOAuthAccessToken());
break;
case ACCOUNT_LOCAL:
loginLocalWithoutAccessToken();
dispatch(loginLocalWithoutAccessToken());
break;
default:
loginWithAccessToken();
dispatch(loginWithAccessToken());
break;
}
})
Expand Down
6 changes: 3 additions & 3 deletions src/common/modals/AccountsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ const ProfileSettings = () => {
dispatch(() => {
switch (account.accountType) {
case ACCOUNT_MICROSOFT:
loginWithOAuthAccessToken(false);
dispatch(loginWithOAuthAccessToken(false));
break;
case ACCOUNT_LOCAL:
loginLocalWithoutAccessToken(false);
dispatch(loginLocalWithoutAccessToken(false));
break;
default:
loginWithAccessToken(false);
dispatch(loginWithAccessToken(false));
break;
}
})
Expand Down
7 changes: 4 additions & 3 deletions src/common/reducers/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,13 @@ export function switchToFirstValidAccount(id) {
await dispatch(() => {
switch (accounts[i].accountType) {
case ACCOUNT_MICROSOFT:
loginWithOAuthAccessToken();
dispatch(loginWithOAuthAccessToken());
break;
case ACCOUNT_LOCAL:
loginLocalWithoutAccessToken();
dispatch(loginLocalWithoutAccessToken());
break;
default:
loginWithAccessToken();
dispatch(loginWithAccessToken());
break;
}
});
Expand Down Expand Up @@ -752,6 +752,7 @@ export function loginWithAccessToken(redirect = true) {

export function loginLocalWithoutAccessToken() {
return async (dispatch, getState) => {
console.log('lol');
const state = getState();
const currentAccount = _getCurrentAccount(state);
const { selectedProfile } = currentAccount;
Expand Down

0 comments on commit 15cafbe

Please sign in to comment.