🔨 fix site code lgtm problems (#21732)

This commit is contained in:
偏右 2020-03-01 19:37:12 +08:00 committed by GitHub
parent f78332171e
commit 301529e0d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,8 +123,7 @@ export function getLocalizedPathname(
},
) {
const pathname = path.startsWith('/') ? path : `/${path}`;
let fullPath = pathname;
let fullPath;
if (!zhCN) {
// to enUS
fullPath = /\/?index-cn/.test(pathname) ? '/' : pathname.replace('-cn', '');
@ -137,7 +136,7 @@ export function getLocalizedPathname(
}
if (hash) {
const localHash = hash[isZhCN ? 'zhCN' : 'enUS'];
const localHash = hash[zhCN ? 'zhCN' : 'enUS'];
fullPath += `#${localHash}`;
}