Add API specs to groups endpoints, convert projectId groups endpoints to be slug-based

This commit is contained in:
Tuan Dang
2024-03-28 18:21:12 -07:00
parent 8afecac7d8
commit 9460eafd91
18 changed files with 213 additions and 146 deletions
@@ -48,7 +48,7 @@ export const GroupModal = ({
const workspaceId = currentWorkspace?.id || "";
const { data: groups } = useGetOrganizationGroups(orgId);
const { data: groupMemberships } = useGetWorkspaceGroupMemberships(workspaceId);
const { data: groupMemberships } = useGetWorkspaceGroupMemberships(currentWorkspace?.slug || "");
const { data: roles } = useGetProjectRoles(workspaceId);
@@ -76,7 +76,7 @@ export const GroupModal = ({
const onFormSubmit = async ({ slug, role }: FormData) => {
try {
await addGroupToWorkspaceMutateAsync({
workspaceId,
projectSlug: currentWorkspace?.slug || "",
groupSlug: slug,
role: role || undefined
});
@@ -252,7 +252,7 @@ export const GroupRoles = ({
try {
await updateGroupWorkspaceRole.mutateAsync({
workspaceId,
projectSlug: currentWorkspace?.slug || "",
groupSlug,
roles: selectedRoles
});
@@ -17,8 +17,6 @@ import { GroupTable } from "./GroupsTable";
export const GroupsSection = () => {
const { currentWorkspace } = useWorkspace();
const workspaceId = currentWorkspace?.id ?? "";
const { mutateAsync: deleteMutateAsync } = useDeleteGroupFromWorkspace();
const { handlePopUpToggle, popUp, handlePopUpOpen, handlePopUpClose } = usePopUp([
@@ -31,7 +29,7 @@ export const GroupsSection = () => {
try {
await deleteMutateAsync({
groupSlug,
workspaceId
projectSlug: currentWorkspace?.slug || ""
});
createNotification({
@@ -33,7 +33,7 @@ type Props = {
export const GroupTable = ({ handlePopUpOpen }: Props) => {
const { currentWorkspace } = useWorkspace();
const { data, isLoading } = useGetWorkspaceGroupMemberships(currentWorkspace?.id || "");
const { data, isLoading } = useGetWorkspaceGroupMemberships(currentWorkspace?.slug || "");
return (
<TableContainer>
<Table>