fix: project setting control fix (#658)

* fix: project setting control fix

* fix: project member endpoint fix
This commit is contained in:
Anmol Singh Bhatia 2023-03-31 18:30:39 +05:30 committed by GitHub
parent fae1534887
commit d596e41d4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,6 @@ import { requiredAdmin } from "lib/auth";
import AppLayout from "layouts/app-layout"; import AppLayout from "layouts/app-layout";
// services // services
import projectService from "services/project.service"; import projectService from "services/project.service";
import workspaceService from "services/workspace.service";
// hooks // hooks
import useToast from "hooks/use-toast"; import useToast from "hooks/use-toast";
// ui // ui
@ -22,7 +21,7 @@ import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs";
import { IProject, IWorkspace } from "types"; import { IProject, IWorkspace } from "types";
import type { NextPage, GetServerSidePropsContext } from "next"; import type { NextPage, GetServerSidePropsContext } from "next";
// fetch-keys // fetch-keys
import { PROJECTS_LIST, PROJECT_DETAILS, WORKSPACE_MEMBERS } from "constants/fetch-keys"; import { PROJECTS_LIST, PROJECT_DETAILS, PROJECT_MEMBERS } from "constants/fetch-keys";
type TControlSettingsProps = { type TControlSettingsProps = {
isMember: boolean; isMember: boolean;
@ -53,8 +52,10 @@ const ControlSettings: NextPage<TControlSettingsProps> = (props) => {
); );
const { data: people } = useSWR( const { data: people } = useSWR(
workspaceSlug ? WORKSPACE_MEMBERS : null, workspaceSlug && projectId ? PROJECT_MEMBERS(projectId as string) : null,
workspaceSlug ? () => workspaceService.workspaceMembers(workspaceSlug as string) : null workspaceSlug && projectId
? () => projectService.projectMembers(workspaceSlug as string, projectId as string)
: null
); );
const { const {
@ -101,7 +102,6 @@ const ControlSettings: NextPage<TControlSettingsProps> = (props) => {
console.log(err); console.log(err);
}); });
}; };
return ( return (
<AppLayout <AppLayout
memberType={{ isMember, isOwner, isViewer, isGuest }} memberType={{ isMember, isOwner, isViewer, isGuest }}
@ -140,7 +140,7 @@ const ControlSettings: NextPage<TControlSettingsProps> = (props) => {
> >
{people?.map((person) => ( {people?.map((person) => (
<CustomSelect.Option <CustomSelect.Option
key={person.id} key={person.member.id}
value={person.member.id} value={person.member.id}
className="flex items-center gap-2" className="flex items-center gap-2"
> >
@ -200,7 +200,7 @@ const ControlSettings: NextPage<TControlSettingsProps> = (props) => {
> >
{people?.map((person) => ( {people?.map((person) => (
<CustomSelect.Option <CustomSelect.Option
key={person.id} key={person.member.id}
value={person.member.id} value={person.member.id}
className="flex items-center gap-2" className="flex items-center gap-2"
> >