From 7aa9e0bba16edffdaf2846e3939ca4fd165c5cb5 Mon Sep 17 00:00:00 2001 From: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com> Date: Mon, 17 Apr 2023 18:22:04 +0530 Subject: [PATCH 1/3] fix: project authorization api fetch keys (#858) --- apps/app/contexts/project-member.context.tsx | 2 +- .../project-authorization-wrapper.tsx | 21 +------------------ 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/apps/app/contexts/project-member.context.tsx b/apps/app/contexts/project-member.context.tsx index c7e758a10..bb8fd6fca 100644 --- a/apps/app/contexts/project-member.context.tsx +++ b/apps/app/contexts/project-member.context.tsx @@ -34,7 +34,7 @@ export const ProjectMemberProvider: React.FC = (props) => { const { workspaceSlug, projectId } = router.query; const { data: memberDetails, error } = useSWR( - workspaceSlug && projectId ? USER_PROJECT_VIEW(workspaceSlug.toString()) : null, + workspaceSlug && projectId ? USER_PROJECT_VIEW(projectId.toString()) : null, workspaceSlug && projectId ? () => projectService.projectMemberMe(workspaceSlug.toString(), projectId.toString()) : null, diff --git a/apps/app/layouts/auth-layout/project-authorization-wrapper.tsx b/apps/app/layouts/auth-layout/project-authorization-wrapper.tsx index 9caaa3e26..7986227f3 100644 --- a/apps/app/layouts/auth-layout/project-authorization-wrapper.tsx +++ b/apps/app/layouts/auth-layout/project-authorization-wrapper.tsx @@ -21,7 +21,6 @@ import { PrimaryButton, Spinner } from "components/ui"; // icons import { LayerDiagonalIcon } from "components/icons"; - type Meta = { title?: string | null; description?: string | null; @@ -61,9 +60,7 @@ const ProjectAuthorizationWrapped: React.FC = ({ const router = useRouter(); const { workspaceSlug, projectId } = router.query; - const { - issueView, - } = useIssuesView(); + const { issueView } = useIssuesView(); const { loading, error, memberRole: memberType } = useProjectMyMembership(); @@ -97,22 +94,6 @@ const ProjectAuthorizationWrapped: React.FC = ({ - ) : error?.status === 401 || error?.status === 403 ? ( - - ) : error?.status === 404 ? ( -
-
-

No such project exist. Create one?

- { - const e = new KeyboardEvent("keydown", { key: "p" }); - document.dispatchEvent(e); - }} - > - Create project - -
-
) : settingsLayout && (memberType?.isGuest || memberType?.isViewer) ? ( Date: Mon, 17 Apr 2023 18:34:18 +0530 Subject: [PATCH 2/3] fix: delete import (#859) --- apps/app/components/integration/delete-import-modal.tsx | 7 +++++-- apps/app/services/integration/index.ts | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/app/components/integration/delete-import-modal.tsx b/apps/app/components/integration/delete-import-modal.tsx index 8c0e10874..b1ae01cc8 100644 --- a/apps/app/components/integration/delete-import-modal.tsx +++ b/apps/app/components/integration/delete-import-modal.tsx @@ -45,7 +45,7 @@ export const DeleteImportModal: React.FC = ({ isOpen, handleClose, data } false ); - IntegrationService.deleteImporterService(workspaceSlug as string, data.id) + IntegrationService.deleteImporterService(workspaceSlug as string, data.service, data.id) .catch(() => setToastAlert({ type: "error", @@ -53,7 +53,10 @@ export const DeleteImportModal: React.FC = ({ isOpen, handleClose, data } message: "Something went wrong. Please try again.", }) ) - .finally(() => setDeleteLoading(false)); + .finally(() => { + setDeleteLoading(false); + handleClose(); + }); }; if (!data) return <>; diff --git a/apps/app/services/integration/index.ts b/apps/app/services/integration/index.ts index 7adba88e8..45ee0adb8 100644 --- a/apps/app/services/integration/index.ts +++ b/apps/app/services/integration/index.ts @@ -43,8 +43,12 @@ class IntegrationService extends APIService { }); } - async deleteImporterService(workspaceSlug: string, importerId: string): Promise { - return this.delete(`/api/workspaces/${workspaceSlug}/importers/${importerId}/`) + async deleteImporterService( + workspaceSlug: string, + service: string, + importerId: string + ): Promise { + return this.delete(`/api/workspaces/${workspaceSlug}/importers/${service}/${importerId}/`) .then((res) => res?.data) .catch((error) => { throw error?.response?.data; From 0fa3a8c3e33d381e30efd98f60fd5de3fbc7b329 Mon Sep 17 00:00:00 2001 From: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com> Date: Mon, 17 Apr 2023 18:38:07 +0530 Subject: [PATCH 3/3] fix: removed useEffect for project detail fetch error (#860) --- apps/app/hooks/use-project-details.tsx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/apps/app/hooks/use-project-details.tsx b/apps/app/hooks/use-project-details.tsx index c18890311..477c82587 100644 --- a/apps/app/hooks/use-project-details.tsx +++ b/apps/app/hooks/use-project-details.tsx @@ -1,5 +1,3 @@ -import { useEffect } from "react"; - import { useRouter } from "next/router"; import useSWR from "swr"; @@ -24,14 +22,6 @@ const useProjectDetails = () => { : null ); - useEffect(() => { - if (projectDetailsError?.status === 404) { - router.push("/404"); - } else if (projectDetailsError) { - router.push("/error"); - } - }, [projectDetailsError, router]); - return { projectDetails, projectDetailsError,