feat(github): support per-workspace GitHub App registrations (#1810)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { GitHubIntegrationPage } from "@/components/github/github-settings";
|
||||
import { StateHydrator } from "@/components/state-hydrator";
|
||||
import { normalizeGitHubStatus } from "@/hooks/domains/github/use-github-status";
|
||||
import { fetchGitHubStatus } from "@/lib/api/domains/github-api";
|
||||
|
||||
type IntegrationsGitHubPageProps = {
|
||||
@@ -9,16 +10,24 @@ type IntegrationsGitHubPageProps = {
|
||||
export default async function IntegrationsGitHubPage({
|
||||
workspaceId,
|
||||
}: IntegrationsGitHubPageProps = {}) {
|
||||
const status = await fetchGitHubStatus({ cache: "no-store" }).catch(() => null);
|
||||
const initialState = status
|
||||
? {
|
||||
githubStatus: {
|
||||
status,
|
||||
loaded: true,
|
||||
loading: false,
|
||||
},
|
||||
}
|
||||
: {};
|
||||
const status = workspaceId
|
||||
? await fetchGitHubStatus(workspaceId, { cache: "no-store" }).catch(() => null)
|
||||
: null;
|
||||
const statusWorkspaceId = workspaceId ?? status?.workspace_id;
|
||||
const initialState =
|
||||
status && statusWorkspaceId
|
||||
? {
|
||||
githubStatus: {
|
||||
byWorkspaceId: {
|
||||
[statusWorkspaceId]: {
|
||||
status: normalizeGitHubStatus(status),
|
||||
loaded: true,
|
||||
loading: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
: {};
|
||||
return (
|
||||
<>
|
||||
<StateHydrator initialState={initialState} />
|
||||
|
||||
Reference in New Issue
Block a user