From 240b86c1d57ea693708283b5f71b330da839fb53 Mon Sep 17 00:00:00 2001 From: = Date: Mon, 6 Jan 2025 19:48:50 +0530 Subject: [PATCH] fix: resolved project list issue and app connection github not listed --- frontend/src/hooks/api/workspace/queries.tsx | 2 +- .../GithubOauthCallbackPage/route.tsx | 13 ++++++++----- .../AppConnectionForm/GitHubConnectionForm.tsx | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/frontend/src/hooks/api/workspace/queries.tsx b/frontend/src/hooks/api/workspace/queries.tsx index 2c7e75a97..7ceeec450 100644 --- a/frontend/src/hooks/api/workspace/queries.tsx +++ b/frontend/src/hooks/api/workspace/queries.tsx @@ -151,7 +151,7 @@ export const useGetUserWorkspaces = ({ type?: ProjectType | "all"; } = {}) => useQuery({ - queryKey: workspaceKeys.getAllUserWorkspace(), + queryKey: workspaceKeys.getAllUserWorkspace(type), queryFn: () => fetchUserWorkspaces(includeRoles, type) }); diff --git a/frontend/src/pages/organization/AppConnections/GithubOauthCallbackPage/route.tsx b/frontend/src/pages/organization/AppConnections/GithubOauthCallbackPage/route.tsx index c7bd3e40f..a5fd03a38 100644 --- a/frontend/src/pages/organization/AppConnections/GithubOauthCallbackPage/route.tsx +++ b/frontend/src/pages/organization/AppConnections/GithubOauthCallbackPage/route.tsx @@ -1,18 +1,21 @@ -import { createFileRoute } from "@tanstack/react-router"; +import { createFileRoute, stripSearchParams } from "@tanstack/react-router"; import { zodValidator } from "@tanstack/zod-adapter"; import { z } from "zod"; import { GitHubOAuthCallbackPage } from "./GithubOauthCallbackPage"; const GitHubOAuthCallbackPageQueryParamsSchema = z.object({ - code: z.string(), - state: z.string(), - installation_id: z.string() + code: z.string().catch(""), + state: z.string().catch(""), + installation_id: z.string().catch("") }); export const Route = createFileRoute( "/_authenticate/_inject-org-details/organization/_layout/app-connections/github/oauth/callback" )({ component: GitHubOAuthCallbackPage, - validateSearch: zodValidator(GitHubOAuthCallbackPageQueryParamsSchema) + validateSearch: zodValidator(GitHubOAuthCallbackPageQueryParamsSchema), + search: { + middlewares: [stripSearchParams({ state: "", installation_id: "" })] + } }); diff --git a/frontend/src/pages/organization/SettingsPage/components/AppConnectionsTab/components/AppConnectionForm/GitHubConnectionForm.tsx b/frontend/src/pages/organization/SettingsPage/components/AppConnectionsTab/components/AppConnectionForm/GitHubConnectionForm.tsx index 346eeb954..aa7865cbb 100644 --- a/frontend/src/pages/organization/SettingsPage/components/AppConnectionsTab/components/AppConnectionForm/GitHubConnectionForm.tsx +++ b/frontend/src/pages/organization/SettingsPage/components/AppConnectionsTab/components/AppConnectionForm/GitHubConnectionForm.tsx @@ -74,7 +74,7 @@ export const GitHubConnectionForm = ({ appConnection }: Props) => { break; case GitHubConnectionMethod.OAuth: window.location.assign( - `https://github.com/login/oauth/authorize?client_id=${oauthClientId}&response_type=code&scope=repo,admin:org&redirect_uri=${window.location.origin}/app-connections/github/oauth/callback&state=${state}` + `https://github.com/login/oauth/authorize?client_id=${oauthClientId}&response_type=code&scope=repo,admin:org&redirect_uri=${window.location.origin}/organization/app-connections/github/oauth/callback&state=${state}` ); break; default: