💄 Better title

This commit is contained in:
LittleSheep 2024-03-16 13:25:39 +08:00
parent 37a68eac28
commit f3473aeb83
2 changed files with 27 additions and 5 deletions

View File

@ -14,9 +14,24 @@ const router = createRouter({
path: "/", path: "/",
component: UserCenterLayout, component: UserCenterLayout,
children: [ children: [
{ path: "/", name: "dashboard", component: () => import("@/views/dashboard.vue") }, {
{ path: "/me/personalize", name: "personalize", component: () => import("@/views/personalize.vue") }, path: "/",
{ path: "/me/security", name: "security", component: () => import("@/views/security.vue") }, name: "dashboard",
component: () => import("@/views/dashboard.vue"),
meta: { title: "Your account" },
},
{
path: "/me/personalize",
name: "personalize",
component: () => import("@/views/personalize.vue"),
meta: { title: "Your personality" },
},
{
path: "/me/security",
name: "security",
component: () => import("@/views/security.vue"),
meta: { title: "Your security" },
},
], ],
}, },
], ],
@ -28,13 +43,13 @@ const router = createRouter({
path: "sign-in", path: "sign-in",
name: "auth.sign-in", name: "auth.sign-in",
component: () => import("@/views/auth/sign-in.vue"), component: () => import("@/views/auth/sign-in.vue"),
meta: { public: true }, meta: { public: true, title: "Sign in" },
}, },
{ {
path: "sign-up", path: "sign-up",
name: "auth.sign-up", name: "auth.sign-up",
component: () => import("@/views/auth/sign-up.vue"), component: () => import("@/views/auth/sign-up.vue"),
meta: { public: true }, meta: { public: true, title: "Sign up" },
}, },
{ {
path: "o/connect", path: "o/connect",
@ -52,6 +67,12 @@ router.beforeEach(async (to, from, next) => {
await id.readProfiles() await id.readProfiles()
} }
if (to.meta.title) {
document.title = `Solarpass | ${to.meta.title}`
} else {
document.title = "Solarpass"
}
if (!to.meta.public && !id.userinfo.isLoggedIn) { if (!to.meta.public && !id.userinfo.isLoggedIn) {
next({ name: "auth.sign-in", query: { redirect_uri: to.fullPath } }) next({ name: "auth.sign-in", query: { redirect_uri: to.fullPath } })
} else { } else {

View File

@ -120,6 +120,7 @@ async function preconnect() {
panel.value = "callback" panel.value = "callback"
callback(data["session"]) callback(data["session"])
} else { } else {
document.title = `Solarpass | Connect to ${data["client"]?.name}`
metadata.value = data["client"] metadata.value = data["client"]
loading.value = false loading.value = false
} }