From 6b450fc03a8387cb113065f5523bc8986c794e03 Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 21 Apr 2025 01:24:41 +0800 Subject: [PATCH] . --- components/utility/profile-settings.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/utility/profile-settings.tsx b/components/utility/profile-settings.tsx index 958607a..2aedc8b 100644 --- a/components/utility/profile-settings.tsx +++ b/components/utility/profile-settings.tsx @@ -138,11 +138,12 @@ export const ProfileSettings: FC = ({}) => { const locales = i18nConfig.locales const defaultLocale = i18nConfig.defaultLocale - let locale = defaultLocale + let locale: (typeof locales)[number] = defaultLocale - // 动态判断首段是否是合法语言代码 - if (locales.includes(pathSegments[0])) { - locale = pathSegments[0] + const segment = pathSegments[0] as (typeof locales)[number] + + if (locales.includes(segment)) { + locale = segment } const loginPath = locale === defaultLocale ? "/login" : `/${locale}/login`