Skip to content

Commit

Permalink
differ mojang and microsoft account types
Browse files Browse the repository at this point in the history
  • Loading branch information
Proxwian committed Feb 29, 2024
1 parent de1e41b commit 2514a2a
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/common/reducers/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ export function switchToFirstValidAccount(id) {
await dispatch(
accounts[i].accountType === ACCOUNT_MICROSOFT
? loginWithOAuthAccessToken()
: login(accounts[i].selectedProfile.name, true, true)
: loginWithAccessToken()
);
found = accounts[i].selectedProfile.id;
} catch {
Expand Down Expand Up @@ -354,7 +354,7 @@ export function selectFirstValidAccount(id) {
await dispatch(
accounts[i].accountType === ACCOUNT_MICROSOFT
? loginWithOAuthAccessToken()
: login(accounts[i].selectedProfile.name, true, true)
: loginWithAccessToken()
);
found = accounts[i].selectedProfile.id;
} catch {
Expand Down Expand Up @@ -803,12 +803,12 @@ export function loginWithAccessToken(redirect = true) {
try {
let skinUrl = null;
switch (accountType) {
case 'mojang':
case ACCOUNT_MOJANG:
skinUrl = await getPlayerSkinMojang(selectedProfile.id);
case 'oxauth':
case ACCOUNT_OXAUTH:
skinUrl = await getPlayerSkinOx(selectedProfile.name);
break;
case 'elyby':
case ACCOUNT_ELYBY:
skinUrl = await getPlayerSkinElyBy(selectedProfile.name);
break;
default:
Expand All @@ -834,15 +834,19 @@ export function loginWithAccessToken(redirect = true) {
let data = null;
let skinUrl = null;
switch (accountType) {
case 'mojang':
case ACCOUNT_MOJANG:
skinUrl = await getPlayerSkinMojang(selectedProfile.id);
data = await mcRefresh(accessToken, clientToken);
break;
case 'oxauth':
case ACCOUNT_MICROSOFT:
skinUrl = await getPlayerSkinMojang(selectedProfile.id);
data = await mcRefresh(accessToken, clientToken);
break;
case ACCOUNT_OXAUTH:
skinUrl = await getPlayerSkinOx(selectedProfile.name);
data = await oxRefresh(accessToken, clientToken);
break;
case 'elyby':
case ACCOUNT_ELYBY:
skinUrl = await getPlayerSkinElyBy(selectedProfile.name);
data = await elybyRefresh(accessToken, clientToken);
break;
Expand Down

0 comments on commit 2514a2a

Please sign in to comment.