From 01528108339218da0c8c82cf5709faae489beead Mon Sep 17 00:00:00 2001 From: OJ Abba Date: Tue, 1 Jul 2025 11:50:47 +0100 Subject: [PATCH] =?UTF-8?q?[Chore]=20Introduce=20errors=20=F0=9F=92=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Main.tsx | 57 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/src/pages/Main.tsx b/src/pages/Main.tsx index 18342a6..8929173 100644 --- a/src/pages/Main.tsx +++ b/src/pages/Main.tsx @@ -1,27 +1,56 @@ -import { useNavigate } from "react-router-dom"; +// import { useNavigate } from "react-router-dom"; import { LoadingSpinner, - useInitialisedDeskproAppClient, + // useDeskproLatestAppContext, + // useInitialisedDeskproAppClient, } from "@deskpro/app-sdk"; -import { useStore } from "../context/StoreProvider/hooks"; -import { checkIsAuthService } from "../services/github"; +// import { useStore } from "../context/StoreProvider/hooks"; +// import { checkIsAuthService } from "../services/github"; import { Container } from "../components/common"; +import { Button } from "@deskpro/deskpro-ui"; +import { useEffect, useState } from "react"; export const Main = () => { - const navigate = useNavigate(); - const [, dispatch] = useStore(); + // const { context } = useDeskproLatestAppContext() + // console.log("Context Data: ", context?.data) + const [errorState, setErrorState] = useState(null) + // const navigate = useNavigate(); + // const [, dispatch] = useStore(); - useInitialisedDeskproAppClient((client) => { - checkIsAuthService(client) - .then((isAuth) => { - dispatch({ type: "setAuth", isAuth }) - navigate(isAuth ? "/home" : "/log_in") - }) - }); + useEffect(() => { + if (errorState === "left") { + throw new Error("hello") + } + + if (errorState === "right") { + throw "HI" + } + + + + }, [errorState]) + + // throw "String" + + // useInitialisedDeskproAppClient((client) => { + // checkIsAuthService(client) + // .then((isAuth) => { + // dispatch({ type: "setAuth", isAuth }) + // navigate(isAuth ? "/home" : "/log_in") + // }) + // }); return ( - +