|
|
|
@ -7,7 +7,7 @@ import { |
|
|
|
import { unwrapApiBody, type ApiResponse } from '../utils/http/factory' |
|
|
|
|
|
|
|
const route = useRoute() |
|
|
|
const { loggedIn, pending, refresh } = useAuthSession() |
|
|
|
const { loggedIn, refresh, initialized } = useAuthSession() |
|
|
|
const { siteName } = useGlobalConfig() |
|
|
|
|
|
|
|
const showPublicLayoutToggle = computed(() => /^\/@[^/]+$/.test(route.path)) |
|
|
|
@ -40,14 +40,25 @@ const { data: publicHomeHeader } = await useAsyncData( |
|
|
|
|
|
|
|
const headerBrandTo = computed(() => (profileSlug.value ? `/@${profileSlug.value}` : '/')) |
|
|
|
const headerBrandTitle = computed(() => { |
|
|
|
if (profileSlug.value && publicHomeHeader.value?.title) { |
|
|
|
return publicHomeHeader.value.title |
|
|
|
if (!profileSlug.value) { |
|
|
|
return siteName.value |
|
|
|
} |
|
|
|
const t = publicHomeHeader.value?.title |
|
|
|
if (typeof t === 'string' && t.trim().length) { |
|
|
|
return t.trim() |
|
|
|
} |
|
|
|
return siteName.value |
|
|
|
}) |
|
|
|
const headerBrandIconUrl = computed(() => |
|
|
|
profileSlug.value ? publicHomeHeader.value?.iconUrl ?? null : null, |
|
|
|
) |
|
|
|
const headerBrandIconUrl = computed(() => { |
|
|
|
if (!profileSlug.value) { |
|
|
|
return null |
|
|
|
} |
|
|
|
const u = publicHomeHeader.value?.iconUrl |
|
|
|
if (typeof u !== 'string' || !u.trim()) { |
|
|
|
return null |
|
|
|
} |
|
|
|
return u.trim() |
|
|
|
}) |
|
|
|
|
|
|
|
type LayoutBySlug = Record<string, PublicHomeLayoutMode> |
|
|
|
|
|
|
|
@ -137,7 +148,7 @@ onMounted(() => { |
|
|
|
<span class="hidden sm:inline">阅读</span> |
|
|
|
</UButton> |
|
|
|
</div> |
|
|
|
<template v-if="pending && !loggedIn"> |
|
|
|
<template v-if="!initialized"> |
|
|
|
<USkeleton class="h-5 w-12 rounded" /> |
|
|
|
</template> |
|
|
|
<NuxtLink |
|
|
|
|