diff --git a/components/ui/dashboard/DashboardBody.js b/components/ui/dashboard/DashboardBody.js index 89b60329b42..f43aa182f97 100644 --- a/components/ui/dashboard/DashboardBody.js +++ b/components/ui/dashboard/DashboardBody.js @@ -1,7 +1,7 @@ 'use client' -import { UserProfile } from '@clerk/nextjs' import dynamic from 'next/dynamic' import { useRouter } from 'next/router' +import DashboardUser from './DashboardUser' const DashboardMenuList = dynamic(() => import('./DashboardMenuList')) const DashboardItemMembership = dynamic( @@ -25,21 +25,11 @@ export default function DashboardBody() {
+ {/* 控制台右侧内容 */}
{basePath === '/dashboard' && } - {(basePath === '/dashboard/user-profile' || - basePath === '/dashboard/user-profile/security') && ( - + {basePath?.indexOf('/dashboard/user-profile') === 0 && ( + )} {basePath === '/dashboard/balance' && } {basePath === '/dashboard/membership' && } diff --git a/components/ui/dashboard/DashboardHeader.js b/components/ui/dashboard/DashboardHeader.js index 7542eea1cce..f564374fded 100644 --- a/components/ui/dashboard/DashboardHeader.js +++ b/components/ui/dashboard/DashboardHeader.js @@ -1,8 +1,9 @@ import LazyImage from '@/components/LazyImage' import { useGlobal } from '@/lib/global' import formatDate from '@/lib/utils/formatDate' -import { SignOutButton } from '@clerk/nextjs' import Link from 'next/link' +import DashboardSignOutButton from './DashboardSignOutButton' + /** * 仪表盘页头 * @returns @@ -39,13 +40,7 @@ export default function DashboardHeader() { {/* 登出按钮 */}
- - - +
diff --git a/components/ui/dashboard/DashboardSignOutButton.js b/components/ui/dashboard/DashboardSignOutButton.js new file mode 100644 index 00000000000..5a58159ac83 --- /dev/null +++ b/components/ui/dashboard/DashboardSignOutButton.js @@ -0,0 +1,20 @@ +import { SignOutButton } from '@clerk/nextjs' +/** + * 控制台登出按钮 + * @returns + */ +export default function DashboardSignOutButton() { + const enableClerk = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY + if (!enableClerk) { + return null + } + return ( + + + + ) +} diff --git a/components/ui/dashboard/DashboardUser.js b/components/ui/dashboard/DashboardUser.js new file mode 100644 index 00000000000..4ce6ad11610 --- /dev/null +++ b/components/ui/dashboard/DashboardUser.js @@ -0,0 +1,24 @@ +import { UserProfile } from '@clerk/nextjs' +/** + * 控制台用户账号面板 + * @returns + */ +export default function DashboardUser() { + const enableClerk = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY + if (!enableClerk) { + return null + } + return ( + + ) +} diff --git a/lib/cache/cache_manager.js b/lib/cache/cache_manager.js index bbfbfdacb68..1d665ca119f 100644 --- a/lib/cache/cache_manager.js +++ b/lib/cache/cache_manager.js @@ -10,10 +10,11 @@ import MemoryCache from './memory_cache' export async function getDataFromCache(key, force) { if (BLOG.ENABLE_CACHE || force) { const dataFromCache = await getApi().getCache(key) - if (JSON.stringify(dataFromCache) === '[]') { + if (!dataFromCache || JSON.stringify(dataFromCache) === '[]') { return null } - return getApi().getCache(key) + // console.trace('[API-->>缓存]:', key, dataFromCache) + return dataFromCache } else { return null } @@ -23,6 +24,7 @@ export async function setDataToCache(key, data) { if (!data) { return } + // console.trace('[API-->>缓存写入]:', key) await getApi().setCache(key, data) }