forked from cerc-io/snowballtools-base
Refactor to fetch organization and deployment details in the parent component (#23)
* Refactor to fetch organization details in the parent component * Fetch and use deployment details for a project * Remove deployment field from ProjectDetails type --------- Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
committed by
Ashwin Phatak
co-authored by
neeraj
parent
62c969d1ff
commit
af021d3357
@@ -1,6 +1,6 @@
|
||||
import { ApolloClient, InMemoryCache, NormalizedCacheObject } from '@apollo/client';
|
||||
|
||||
import { getUser, getOrganizations } from './gql-queries';
|
||||
import { getUser, getOrganizations, getDeployments } from './gql-queries';
|
||||
|
||||
export interface GraphQLConfig {
|
||||
gqlEndpoint: string;
|
||||
@@ -31,4 +31,15 @@ export class GQLClient {
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
async getDeployments (projectId: string) : Promise<any> {
|
||||
const { data } = await this.client.query({
|
||||
query: getDeployments,
|
||||
variables: {
|
||||
projectId
|
||||
}
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,13 @@ query {
|
||||
export const getOrganizations = gql`
|
||||
query {
|
||||
organizations {
|
||||
id
|
||||
name
|
||||
projects {
|
||||
id
|
||||
owner {
|
||||
id
|
||||
name
|
||||
}
|
||||
deployments {
|
||||
id
|
||||
@@ -42,3 +45,28 @@ query {
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const getDeployments = gql`
|
||||
query ($projectId: String!) {
|
||||
deployments(projectId: $projectId) {
|
||||
id
|
||||
domain{
|
||||
branch
|
||||
createdAt
|
||||
isRedirected
|
||||
id
|
||||
name
|
||||
status
|
||||
updatedAt
|
||||
}
|
||||
branch
|
||||
commitHash
|
||||
title
|
||||
environment
|
||||
isCurrent
|
||||
status
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user