feat: not-found url error
This commit is contained in:
@@ -13,6 +13,7 @@ export default function Home() {
|
||||
const [url, setUrl] = useState("");
|
||||
const [expiryTime, setExpiryTime] = useState(0);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [notFound, setNotFound] = useState(false);
|
||||
const initData = useRawInitData();
|
||||
const onCopyClick = async () => {
|
||||
if (!url.length) return;
|
||||
@@ -32,12 +33,24 @@ export default function Home() {
|
||||
setIsLoading(false);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
setNotFound(true);
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
fetchData();
|
||||
}, [initData]);
|
||||
if (isLoading) return <Loader />;
|
||||
|
||||
if (notFound) {
|
||||
return (
|
||||
<Page back={false}>
|
||||
<main className="absolute bottom-0 left-0 flex w-full flex-col items-center gap-3 px-2.5 py-3.5 text-[var(--tg-theme-text-color)]">
|
||||
<Block name="Ссылка">Ссылка не найдена</Block>
|
||||
</main>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Page back={false}>
|
||||
<header className="flex h-12 w-full flex-col items-center justify-center bg-[var(--tg-theme-header-bg-color)]">
|
||||
|
||||
Reference in New Issue
Block a user