mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-12 19:02:53 +08:00
fix: external warning
This commit is contained in:
parent
00f2704190
commit
01762ea804
@ -37,21 +37,22 @@ const StyledTitle = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
const isExternal = () => {
|
||||
if (typeof window === "undefined") return true;
|
||||
|
||||
if (window.location.pathname.includes("widget")) return false;
|
||||
if (window.location.host !== "jsoncrack.com") return true;
|
||||
return false;
|
||||
};
|
||||
|
||||
const ExternalMode = () => {
|
||||
const [isExternal, setExternal] = React.useState(false);
|
||||
const [isOpen, setOpen] = React.useState(false);
|
||||
|
||||
if (!isExternal()) return null;
|
||||
React.useEffect(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
if (window.location.pathname.includes("widget")) return setExternal(false);
|
||||
if (window.location.host !== "jsoncrack.com") return setExternal(true);
|
||||
return setExternal(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const closeModal = () => setOpen(false);
|
||||
|
||||
if (isExternal) return null;
|
||||
|
||||
return (
|
||||
<StyledAlert>
|
||||
<Button
|
||||
|
Loading…
x
Reference in New Issue
Block a user