feat: notify apollo error on screen.
This commit is contained in:
@@ -3,11 +3,10 @@ import { prepareRoutes } from "@curi/router";
|
||||
import { omit } from 'ramda';
|
||||
import React from 'react';
|
||||
import { CreateProjectInput, Pipeline, Project } from './generated/graphql';
|
||||
import { PipelineDetail } from './pipelines';
|
||||
import { ProjectDetail, ProjectEditor, PROJECT } from "./projects";
|
||||
import { COMMIT_LIST_QUERY } from './commons/graphql/queries';
|
||||
import { CommitList } from './commits/commit-list';
|
||||
import { COMMITS } from './commits/queries';
|
||||
import { PipelineTaskDetail } from './pipeline-tasks/pipeline-task-detail';
|
||||
|
||||
export default prepareRoutes([
|
||||
{
|
||||
@@ -93,9 +92,36 @@ export default prepareRoutes([
|
||||
return {
|
||||
body: () => (
|
||||
<ProjectDetail project={omit(["__typename"], data.project)}>
|
||||
<CommitList
|
||||
pipeline={omit(["__typename"], data.pipeline)}
|
||||
/>
|
||||
<CommitList pipeline={omit(["__typename"], data.pipeline)} />
|
||||
</ProjectDetail>
|
||||
),
|
||||
};
|
||||
},
|
||||
respond({ resolved, error }) {
|
||||
return resolved || <div>Failed</div>;
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "pipeline-task-detail",
|
||||
path: "pipelines/:pipelineId/tasks/:taskId",
|
||||
async resolve(
|
||||
matched,
|
||||
{ client }: { client: ApolloClient<InMemoryCache> }
|
||||
) {
|
||||
const { data } = await client.query<{
|
||||
pipeline: Pipeline;
|
||||
project: Project;
|
||||
}>({
|
||||
query: COMMIT_LIST_QUERY,
|
||||
variables: {
|
||||
projectId: matched?.params.projectId,
|
||||
pipelineId: matched?.params.pipelineId,
|
||||
},
|
||||
});
|
||||
return {
|
||||
body: () => (
|
||||
<ProjectDetail project={omit(["__typename"], data.project)}>
|
||||
<PipelineTaskDetail taskId={matched?.params.taskId} />
|
||||
</ProjectDetail>
|
||||
),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user