From a8cb29e6bbdae9ecd606824d338882a2569e8c15 Mon Sep 17 00:00:00 2001 From: Korbs Date: Fri, 21 Jun 2024 05:18:06 -0400 Subject: [PATCH] Add API --- src/pages/api/language/en.astro | 12 ++++++++++++ src/pages/api/language/jp.astro | 12 ++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/pages/api/language/en.astro create mode 100644 src/pages/api/language/jp.astro diff --git a/src/pages/api/language/en.astro b/src/pages/api/language/en.astro new file mode 100644 index 0000000..44848d6 --- /dev/null +++ b/src/pages/api/language/en.astro @@ -0,0 +1,12 @@ +--- +import { changeLanguage } from "i18next"; + +changeLanguage("en"); + +Astro.cookies.set("Language", "EN", { + path: "/", + sameSite: 'strict' +}); +return Astro.redirect("/"); +--- + \ No newline at end of file diff --git a/src/pages/api/language/jp.astro b/src/pages/api/language/jp.astro new file mode 100644 index 0000000..d0d8ca5 --- /dev/null +++ b/src/pages/api/language/jp.astro @@ -0,0 +1,12 @@ +--- +import { changeLanguage } from "i18next"; + +changeLanguage("jp"); + +Astro.cookies.set("Language", "JP", { + path: "/", + sameSite: 'strict' +}); +return Astro.redirect("/"); +--- + \ No newline at end of file