Skip to content

Commit

Permalink
chore: adjusting interceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-logan committed May 30, 2024
1 parent 3940aec commit 9c9ae7b
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions docs/src/components/Intercepter/index.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,24 @@
"use client";

import { redirect } from "next/navigation";
import { useEffect, useState } from "react";
import { useEffect } from "react";

import { getBrowserLang } from "../Internationalization";

export default function Intercepter() {
const browserLang = getBrowserLang();
const [lang, setLang] = useState("en");

useEffect(() => {
const verify =
(browserLang &&
(browserLang[0] === "pt" || browserLang[0] === "pt-BR")) ||
(browserLang && (browserLang[1] === "pt" || browserLang[1] === "pt-BR"));
if (verify) {
setLang("pt");
document.documentElement.lang = "pt";

redirect("/pt");
}
}, []);

return (
<>
{lang === "pt" && (
<div className="min-h-screen">
<p className="text-center text-white">
Retornando para a página em português...
</p>
</div>
)}
</>
);
return null;
}

0 comments on commit 9c9ae7b

Please sign in to comment.