diff --git a/index.html b/index.html index fe303c0..6eab3fb 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - Rustdesk-Api-Admin + Rustdesk API Admin
diff --git a/src/permission.js b/src/permission.js index f58b285..9281308 100644 --- a/src/permission.js +++ b/src/permission.js @@ -13,6 +13,7 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration const whiteList = ['/login', '/register'] const routeStore = useRouteStore(pinia) const appStore = useAppStore(pinia) +appStore.getAdminConfig() router.beforeEach(async (to, from, next) => { document.title = T(to.meta?.title) + ' - ' + appStore.setting.title diff --git a/src/store/app.js b/src/store/app.js index 8aff291..a71f0b7 100644 --- a/src/store/app.js +++ b/src/store/app.js @@ -23,7 +23,7 @@ export const useAppStore = defineStore({ id: 'App', state: () => ({ setting: { - title: 'Rustdesk-Api-Admin', + title: 'Rustdesk API Admin', hello: '', sideIsCollapse: false, logo, @@ -55,17 +55,21 @@ export const useAppStore = defineStore({ }, getAppConfig () { console.log('getAppConfig') - app().then(res => { + return app().then(res => { this.setting.appConfig = res.data }) }, getAdminConfig () { console.log('getAdminConfig') - admin().then(res => { - this.setting.title = res.data.title + return admin().then(res => { + this.replaceAdminTitle(res.data.title) this.setting.hello = res.data.hello }) }, + replaceAdminTitle(newTitle){ + document.title = document.title.replace(`- ${this.setting.title}`, `- ${newTitle}`) + this.setting.title = newTitle + }, }, })