feat(commits): commit and task list.
This commit is contained in:
@ -1,6 +1,29 @@
|
||||
import { ApolloClient, InMemoryCache } from "@apollo/client";
|
||||
import { ApolloClient, ApolloLink, HttpLink, InMemoryCache } from "@apollo/client";
|
||||
import { withScalars } from 'apollo-link-scalars';
|
||||
import { buildClientSchema, IntrospectionQuery } from 'graphql';
|
||||
import { DateTimeResolver } from 'graphql-scalars';
|
||||
import introspectionResult from "../../generated/graphql.schema.json";
|
||||
|
||||
export const client = new ApolloClient({
|
||||
const schema = buildClientSchema(
|
||||
(introspectionResult as unknown) as IntrospectionQuery
|
||||
);
|
||||
|
||||
const httpLink = new HttpLink({
|
||||
uri: "/api/graphql",
|
||||
cache: new InMemoryCache(),
|
||||
});
|
||||
|
||||
const typesMap = {
|
||||
DateTime: DateTimeResolver,
|
||||
};
|
||||
const link = ApolloLink.from([
|
||||
(withScalars({ schema, typesMap }) as unknown) as ApolloLink,
|
||||
httpLink,
|
||||
]);
|
||||
|
||||
export function createApolloClient() {
|
||||
return new ApolloClient({
|
||||
ssrMode: typeof window === "undefined",
|
||||
link,
|
||||
cache: new InMemoryCache(),
|
||||
});
|
||||
}
|
26
src/commons/graphql/queries.ts
Normal file
26
src/commons/graphql/queries.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const COMMIT_LIST_QUERY = gql`
|
||||
query CommitListQuery($projectId: String!, $pipelineId: String!) {
|
||||
project(id: $projectId) {
|
||||
id
|
||||
name
|
||||
comment
|
||||
webUrl
|
||||
sshUrl
|
||||
webHookSecret
|
||||
}
|
||||
pipeline(id: $pipelineId) {
|
||||
id
|
||||
name
|
||||
branch
|
||||
workUnitMetadata {
|
||||
version
|
||||
units {
|
||||
type
|
||||
scripts
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
Reference in New Issue
Block a user