From 644686582e386ee9bf853d5e268de487bcc8ac21 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Fri, 17 Jan 2025 19:06:07 -0600 Subject: [PATCH] fix: icon api --- packages/website/src/layouts/BaseLayout.astro | 3 ++- .../api/tankopedia/tank-icon/[id]/_index.tsx | 21 +++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/website/src/layouts/BaseLayout.astro b/packages/website/src/layouts/BaseLayout.astro index 81709be81..1038b0855 100644 --- a/packages/website/src/layouts/BaseLayout.astro +++ b/packages/website/src/layouts/BaseLayout.astro @@ -30,6 +30,7 @@ const locale = Astro.params.locale ?? DEFAULT_LOCALE; import { SUPPORTED_LOCALES } from '@blitzkit/i18n'; import { getBestLocale } from '../core/i18n/getBestLocale'; + const isAPI = window.location.pathname.startsWith('/api'); const isI18nPath = SUPPORTED_LOCALES.some((locale) => window.location.pathname.startsWith(`/${locale}`), ); @@ -38,7 +39,7 @@ const locale = Astro.params.locale ?? DEFAULT_LOCALE; window.location.pathname.startsWith(`/${locale}`), ); - if (bestLocale !== currentPathLocale) { + if (!isAPI && bestLocale !== currentPathLocale) { window.location.pathname = isI18nPath ? window.location.pathname.replace( `/${currentPathLocale}`, diff --git a/packages/website/src/pages/api/tankopedia/tank-icon/[id]/_index.tsx b/packages/website/src/pages/api/tankopedia/tank-icon/[id]/_index.tsx index 213149ea1..96a50aecc 100644 --- a/packages/website/src/pages/api/tankopedia/tank-icon/[id]/_index.tsx +++ b/packages/website/src/pages/api/tankopedia/tank-icon/[id]/_index.tsx @@ -2,6 +2,7 @@ import { TankSandbox } from '../../../../../components/Tankopedia/HeroSection/co import { awaitableModelDefinitions } from '../../../../../core/awaitables/modelDefinitions'; import { awaitableProvisionDefinitions } from '../../../../../core/awaitables/provisionDefinitions'; import { awaitableTankDefinitions } from '../../../../../core/awaitables/tankDefinitions'; +import { LocaleProvider } from '../../../../../hooks/useLocale'; import { App } from '../../../../../stores/app'; import { Duel } from '../../../../../stores/duel'; import { TankopediaEphemeral } from '../../../../../stores/tankopediaEphemeral'; @@ -23,15 +24,17 @@ export function Page({ id }: PageProps) { const model = modelDefinitions.models[id]; return ( - - - - - - - - - + + + + + + + + + + + ); }