Separated all the widgets in the dashboard into their own components

This commit is contained in:
Keannu Christian Bernasol 2023-03-07 21:17:22 +08:00
parent 6619163abe
commit 3b5fb87099
12 changed files with 405 additions and 133 deletions

View file

@ -9,6 +9,8 @@ import ViewManager from "../../Components/ProductsPage/ViewManager";
import { useQuery } from "react-query";
import { GetProducts } from "../../Components/Api/Api";
import LoginChecker from "../../Components/LoginChecker/LoginChecker";
import { useSelector } from "react-redux";
import { OldSessionState } from "../../Interfaces/Interfaces";
export default function Products() {
const navigate = useNavigate();
@ -17,7 +19,10 @@ export default function Products() {
isLoading,
error,
} = useQuery("products", GetProducts, { retry: 0 });
if (isLoading) {
const old_session_checked = useSelector(
(state: OldSessionState) => state.old_session_checked.value
);
if (isLoading || !old_session_checked) {
return (
<div>
<LoginChecker />