Skip to content

Commit fade38b

Browse files
committed
fix: make no user not blocking issue
1 parent 770578b commit fade38b

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/main/service/UserService.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ export default class UserService extends Service {
183183

184184
async init() {
185185
this.refreshUser();
186+
if (this.state.user.selectedUser.id === '' && Object.keys(this.state.user.users).length > 0) {
187+
const [userId, user] = Object.entries(this.state.user.users)[0];
188+
this.switchUserProfile({
189+
userId,
190+
profileId: user.selectedProfile,
191+
});
192+
}
186193
}
187194

188195
/**
@@ -550,7 +557,7 @@ export default class UserService extends Service {
550557
selectedProfile: result.selectedProfile ? result.selectedProfile.id : '',
551558
});
552559
}
553-
if (options.selectProfile && result.selectedProfile) {
560+
if (!this.state.user.selectedUser.id || (options.selectProfile && result.selectedProfile)) {
554561
this.log(`Select the game profile ${result.selectedProfile.id} in user ${result.user!.id}`);
555562
this.commit('userGameProfileSelect', {
556563
profileId: result.selectedProfile.id,

src/renderer/windows/main/components/SideBar.vue

-11
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
style="display: block !important;"
3232
/>
3333
<v-list-tile
34-
:disabled="!logined"
3534
replace
3635
to="/"
3736
>
@@ -40,7 +39,6 @@
4039
</v-list-tile-action>
4140
</v-list-tile>
4241
<v-list-tile
43-
:disabled="!logined"
4442
replace
4543
to="/instances"
4644
>
@@ -49,7 +47,6 @@
4947
</v-list-tile-action>
5048
</v-list-tile>
5149
<v-list-tile
52-
:disabled="!logined"
5350
replace
5451
to="/user"
5552
>
@@ -58,7 +55,6 @@
5855
</v-list-tile-action>
5956
</v-list-tile>
6057
<v-list-tile
61-
:disabled="!logined"
6258
replace
6359
to="/curseforge"
6460
>
@@ -117,16 +113,13 @@ import {
117113
} from '@vue/composition-api';
118114
import {
119115
useRouter,
120-
useCurrentUser,
121-
useUserProfileStatus,
122116
useTaskCount,
123117
} from '@/hooks';
124118
import { useDialog, useAsyncRouteBeforeLeaves } from '../hooks';
125119
126120
export default defineComponent({
127121
setup() {
128122
const { activeTasksCount } = useTaskCount();
129-
const { accessTokenValid: logined } = useUserProfileStatus(useCurrentUser().userProfile);
130123
const { show } = useDialog('task');
131124
const beforeLeaves = useAsyncRouteBeforeLeaves();
132125
@@ -145,9 +138,6 @@ export default defineComponent({
145138
if (!timeTraveling) localHistory.push(from.fullPath);
146139
});
147140
async function goBack() {
148-
if (!logined.value && router.currentRoute.path === '/login') {
149-
return;
150-
}
151141
timeTraveling = true;
152142
const before = localHistory.pop();
153143
if (before) {
@@ -167,7 +157,6 @@ export default defineComponent({
167157
activeTasksCount,
168158
showTaskDialog: show,
169159
goBack,
170-
logined,
171160
onEnterBar() {
172161
startHoverTime = Date.now();
173162
},

0 commit comments

Comments
 (0)