mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
refractor: removed redirection logic from AppLayout
This commit is contained in:
parent
b540c884c5
commit
ada68a9bf7
@ -1,9 +1,4 @@
|
|||||||
// react
|
import React, { useState } from "react";
|
||||||
import React, { useEffect, useState } from "react";
|
|
||||||
// next
|
|
||||||
import { useRouter } from "next/router";
|
|
||||||
// hooks
|
|
||||||
import useUser from "lib/hooks/useUser";
|
|
||||||
// layouts
|
// layouts
|
||||||
import Container from "layouts/Container";
|
import Container from "layouts/Container";
|
||||||
import Sidebar from "layouts/Navbar/Sidebar";
|
import Sidebar from "layouts/Navbar/Sidebar";
|
||||||
@ -15,14 +10,6 @@ import type { Props } from "./types";
|
|||||||
const AppLayout: React.FC<Props> = ({ meta, children, noPadding = false, bg = "primary" }) => {
|
const AppLayout: React.FC<Props> = ({ meta, children, noPadding = false, bg = "primary" }) => {
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const { user, isUserLoading } = useUser();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!isUserLoading && (!user || user === null)) router.push("/signin");
|
|
||||||
}, [isUserLoading, user, router]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container meta={meta}>
|
<Container meta={meta}>
|
||||||
<CreateProjectModal isOpen={isOpen} setIsOpen={setIsOpen} />
|
<CreateProjectModal isOpen={isOpen} setIsOpen={setIsOpen} />
|
||||||
|
Loading…
Reference in New Issue
Block a user