mirror of
https://github.com/aljazceru/landscape-template.git
synced 2026-01-27 18:24:25 +01:00
feat: new error boundary component
This commit is contained in:
@@ -10,6 +10,7 @@ import Button from "src/Components/Button/Button";
|
||||
import { FiCopy } from "react-icons/fi";
|
||||
import useCopyToClipboard from "src/utils/hooks/useCopyToClipboard";
|
||||
import { getPropertyFromUnknown, trimText, } from "src/utils/helperFunctions";
|
||||
import { useErrorHandler } from 'react-error-boundary';
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +34,7 @@ export const useLnurlQuery = () => {
|
||||
const doFetch = async () => {
|
||||
const res = await fetchLnurlAuth();
|
||||
if (!res?.encoded)
|
||||
setError(true)
|
||||
setError(new Error("Response doesn't contain data"))
|
||||
else {
|
||||
setLoading(false);
|
||||
setData({
|
||||
@@ -43,7 +44,7 @@ export const useLnurlQuery = () => {
|
||||
timeOut = setTimeout(doFetch, 1000 * 60 * 2)
|
||||
}
|
||||
}
|
||||
doFetch()
|
||||
doFetch().catch(err => setError(err));
|
||||
|
||||
return () => clearTimeout(timeOut)
|
||||
}, [])
|
||||
@@ -64,8 +65,9 @@ export default function LoginPage() {
|
||||
|
||||
const canFetchIsLogged = useRef(true)
|
||||
const { loadingLnurl, data: { lnurl, session_token }, error } = useLnurlQuery();
|
||||
const clipboard = useCopyToClipboard()
|
||||
|
||||
useErrorHandler(error)
|
||||
const clipboard = useCopyToClipboard()
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
@@ -198,6 +200,8 @@ export default function LoginPage() {
|
||||
|
||||
</div>;
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Helmet>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useParams, Navigate } from 'react-router-dom'
|
||||
import ErrorMessage from 'src/Components/ErrorMessage/ErrorMessage';
|
||||
import ErrorMessage from 'src/Components/Errors/ErrorMessage/ErrorMessage';
|
||||
import { useCategoryPageQuery } from 'src/graphql';
|
||||
import HeaderImage from './HeaderImage/HeaderImage';
|
||||
import ProjectsGrid from './ProjectsGrid/ProjectsGrid';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import ASSETS from 'src/assets';
|
||||
|
||||
import ErrorMessage from 'src/Components/ErrorMessage/ErrorMessage';
|
||||
import ErrorMessage from 'src/Components/Errors/ErrorMessage/ErrorMessage';
|
||||
import HeaderImage from 'src/features/Projects/pages/CategoryPage/HeaderImage/HeaderImage';
|
||||
import ProjectsGrid from 'src/features/Projects/pages/CategoryPage/ProjectsGrid/ProjectsGrid';
|
||||
import { Helmet } from "react-helmet";
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Wallet_Service } from 'src/services'
|
||||
import { useProjectDetailsQuery } from 'src/graphql';
|
||||
import Lightbox from 'src/Components/Lightbox/Lightbox'
|
||||
import linkifyHtml from 'linkify-html';
|
||||
import ErrorMessage from 'src/Components/ErrorMessage/ErrorMessage';
|
||||
import ErrorMessage from 'src/Components/Errors/ErrorMessage/ErrorMessage';
|
||||
import { setVoteAmount } from 'src/redux/features/vote.slice';
|
||||
import { numberFormatter } from 'src/utils/helperFunctions';
|
||||
import { MEDIA_QUERIES } from 'src/utils/theme';
|
||||
|
||||
Reference in New Issue
Block a user