Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

Commit 84e4b05

Browse files
committed
Fix: redirect to install page
1 parent f2512e4 commit 84e4b05

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

src/app/App.vue

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,31 @@ export default {
7575
async created() {
7676
let needToRoot = false;
7777
78+
try {
79+
// Get current panel status information
80+
const statusInfo = await requestPanelStatus();
81+
if (statusInfo.language) {
82+
console.log("SET_LANGUAGE:", statusInfo.language, statusInfo);
83+
this.$i18n.locale = statusInfo.language;
84+
} else {
85+
this.$i18n.locale = "en_us";
86+
}
87+
// If not installed, must route to /install
88+
if (statusInfo?.isInstall === false) {
89+
return router.push({ path: "/install" });
90+
}
91+
} catch (error) {
92+
alert(`Err: ${error}, Please refresh!`);
93+
}
94+
7895
try {
7996
// After the first refresh, try to get user data once
8097
// If it fails, navigate to / view to further decide the jump route
8198
await setupUserInfo();
8299
const userInfo = this.$store.state.userInfo;
83100
if (!userInfo || !userInfo.uuid) throw new Error("userInfo.uuid is null");
84101
} catch (error) {
85-
console.log(error);
102+
console.log("App.vue redirected to root.vue");
86103
needToRoot = true;
87104
}
88105

src/app/i18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import zh_cn from "../language/zh_cn"
33
import en_us from "../language/en_us"
44

55
const i18n = createI18n({
6-
locale: 'zh_cn',
6+
locale: 'en_us',
77
fallbackLocale: 'en_us',
88
messages: {
99
zh_cn,

src/app/views/Root.vue

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<script>
1414
import Panel from "../../components/Panel";
1515
import router from "../router";
16-
import { requestPanelStatus, setupUserInfo } from "../service/protocol";
16+
import { setupUserInfo } from "../service/protocol";
1717
1818
export default {
1919
components: { Panel },
@@ -30,21 +30,6 @@ export default {
3030
}
3131
},
3232
async init() {
33-
try {
34-
// Get current panel status information
35-
const statusInfo = await requestPanelStatus();
36-
if (statusInfo.language) {
37-
console.log("SET_LANGUAGE:", statusInfo.language, statusInfo);
38-
this.$i18n.locale = statusInfo.language;
39-
} else {
40-
this.$i18n.locale = "en_us";
41-
}
42-
// If not installed, must route to /install
43-
if (statusInfo?.isInstall === false) return router.push({ path: "/install" });
44-
} catch (error) {
45-
alert(`Err: ${error}, Please refresh!`);
46-
}
47-
4833
try {
4934
// In order to adapt to seamless login, data must be requested again here
5035
if (this.$store.state.userInfo?.permission && this.$store.state.userInfo?.uuid)

0 commit comments

Comments
 (0)