fix: space user validation check

This commit is contained in:
sriram veeraghanta 2024-05-16 04:03:43 +05:30
parent b14d44049c
commit a195f1bf7e
13 changed files with 92 additions and 65 deletions

View file

@ -1,8 +1,10 @@
"use client";
import { useEffect, FC } from "react";
import { observer } from "mobx-react-lite";
import Link from "next/link";
import { useRouter, useParams, useSearchParams, usePathname } from "next/navigation";
import useSWR from "swr";
// ui
import { Avatar, Button } from "@plane/ui";
// components
@ -21,7 +23,7 @@ export type NavbarControlsProps = {
projectSettings: any;
};
export const NavbarControls: FC<NavbarControlsProps> = (props) => {
export const NavbarControls: FC<NavbarControlsProps> = observer((props) => {
const { workspaceSlug, projectId, projectSettings } = props;
const { views } = projectSettings;
// router
@ -34,7 +36,11 @@ export const NavbarControls: FC<NavbarControlsProps> = (props) => {
const { settings, activeLayout, hydrate, setActiveLayout } = useProject();
hydrate(projectSettings);
const { data: user } = useUser();
const { data: user, fetchCurrentUser } = useUser();
useSWR("CURRENT_USER", () => fetchCurrentUser(), { errorRetryCount: 2 });
console.log("user", user);
useEffect(() => {
if (workspaceSlug && projectId && settings) {
@ -126,4 +132,4 @@ export const NavbarControls: FC<NavbarControlsProps> = (props) => {
)}
</>
);
};
});

View file

@ -1,7 +1,5 @@
"use client";
import { FC } from "react";
import { observer } from "mobx-react-lite";
import { Briefcase } from "lucide-react";
// components
import { ProjectLogo } from "@/components/common";
@ -13,7 +11,7 @@ type IssueNavbarProps = {
projectId: string;
};
const IssueNavbar: FC<IssueNavbarProps> = observer((props) => {
const IssueNavbar: FC<IssueNavbarProps> = (props) => {
const { projectSettings, workspaceSlug, projectId } = props;
const { project_details } = projectSettings;
@ -40,6 +38,6 @@ const IssueNavbar: FC<IssueNavbarProps> = observer((props) => {
</div>
</div>
);
});
};
export default IssueNavbar;