diff --git a/apps/admin/app/layout.tsx b/apps/admin/app/layout.tsx index acaa0ba..ba5a858 100644 --- a/apps/admin/app/layout.tsx +++ b/apps/admin/app/layout.tsx @@ -13,25 +13,31 @@ import NextTopLoader from 'nextjs-toploader'; import React from 'react'; export async function generateMetadata(): Promise { - const config = await getGlobalConfig({ skipErrorHandler: true }).then((res) => res.data.data!); - const site = config.site || {}; - return { - title: { - default: `${site.site_name}`, - template: `%s | ${site.site_name}`, - }, - description: site.site_desc, - icons: { - icon: site.site_logo - ? [ - { - url: site.site_logo, - sizes: 'any', - }, - ] - : [], - }, - }; + try { + const config = await getGlobalConfig({ skipErrorHandler: true }).then((res) => res.data.data!); + const site = config.site || {}; + return { + title: { + default: `${site.site_name}`, + template: `%s | ${site.site_name}`, + }, + description: site.site_desc, + icons: { + icon: site.site_logo + ? [ + { + url: site.site_logo, + sizes: 'any', + }, + ] + : [], + }, + }; + } catch (error) { + return { + title: { default: 'PPanel', template: '%s | PPanel' }, + }; + } } export default async function RootLayout({ children }: { children: React.ReactNode }) { diff --git a/apps/user/app/layout.tsx b/apps/user/app/layout.tsx index b774a50..bd2c2c1 100644 --- a/apps/user/app/layout.tsx +++ b/apps/user/app/layout.tsx @@ -13,25 +13,31 @@ import NextTopLoader from 'nextjs-toploader'; import React from 'react'; export async function generateMetadata(): Promise { - const config = await getGlobalConfig({ skipErrorHandler: true }).then((res) => res.data.data!); - const site = config?.site || {}; - return { - title: { - default: `${site.site_name}`, - template: `%s | ${site.site_name}`, - }, - description: site.site_desc, - icons: { - icon: site.site_logo - ? [ - { - url: site.site_logo, - sizes: 'any', - }, - ] - : [], - }, - }; + try { + const config = await getGlobalConfig({ skipErrorHandler: true }).then((res) => res.data.data!); + const site = config.site || {}; + return { + title: { + default: `${site.site_name}`, + template: `%s | ${site.site_name}`, + }, + description: site.site_desc, + icons: { + icon: site.site_logo + ? [ + { + url: site.site_logo, + sizes: 'any', + }, + ] + : [], + }, + }; + } catch (error) { + return { + title: { default: 'PPanel', template: '%s | PPanel' }, + }; + } } export default async function RootLayout({ children }: { children: React.ReactNode }) {