Skip to content

Commit 15cafbe

Browse files
committed
fixxed auto account login
1 parent 788e311 commit 15cafbe

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/app/desktop/DesktopRoot.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function DesktopRoot({ store }) {
113113
});
114114
}
115115

116-
if (process.env.NODE_ENV === 'development' && currentAccount) {
116+
if (process.env.NODE_ENV !== 'development' && currentAccount) {
117117
dispatch(received(features.mcAuthentication));
118118
dispatch(push('/home'));
119119
} else if (currentAccount) {
@@ -123,13 +123,13 @@ function DesktopRoot({ store }) {
123123
dispatch(() => {
124124
switch (currentAccount.accountType) {
125125
case ACCOUNT_MICROSOFT:
126-
loginWithOAuthAccessToken();
126+
dispatch(loginWithOAuthAccessToken());
127127
break;
128128
case ACCOUNT_LOCAL:
129-
loginLocalWithoutAccessToken();
129+
dispatch(loginLocalWithoutAccessToken());
130130
break;
131131
default:
132-
loginWithAccessToken();
132+
dispatch(loginWithAccessToken());
133133
break;
134134
}
135135
})

src/common/modals/AccountsManager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ const ProfileSettings = () => {
7171
dispatch(() => {
7272
switch (account.accountType) {
7373
case ACCOUNT_MICROSOFT:
74-
loginWithOAuthAccessToken(false);
74+
dispatch(loginWithOAuthAccessToken(false));
7575
break;
7676
case ACCOUNT_LOCAL:
77-
loginLocalWithoutAccessToken(false);
77+
dispatch(loginLocalWithoutAccessToken(false));
7878
break;
7979
default:
80-
loginWithAccessToken(false);
80+
dispatch(loginWithAccessToken(false));
8181
break;
8282
}
8383
})

src/common/reducers/actions.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,13 @@ export function switchToFirstValidAccount(id) {
271271
await dispatch(() => {
272272
switch (accounts[i].accountType) {
273273
case ACCOUNT_MICROSOFT:
274-
loginWithOAuthAccessToken();
274+
dispatch(loginWithOAuthAccessToken());
275275
break;
276276
case ACCOUNT_LOCAL:
277-
loginLocalWithoutAccessToken();
277+
dispatch(loginLocalWithoutAccessToken());
278278
break;
279279
default:
280-
loginWithAccessToken();
280+
dispatch(loginWithAccessToken());
281281
break;
282282
}
283283
});
@@ -752,6 +752,7 @@ export function loginWithAccessToken(redirect = true) {
752752

753753
export function loginLocalWithoutAccessToken() {
754754
return async (dispatch, getState) => {
755+
console.log('lol');
755756
const state = getState();
756757
const currentAccount = _getCurrentAccount(state);
757758
const { selectedProfile } = currentAccount;

0 commit comments

Comments
 (0)