From a0d00743cbbdb77b27c1a3d5711407ffed5befac Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Sat, 20 Aug 2022 21:39:51 +0200 Subject: refactor(types): move and rename GraphQL types The api file in services was not really readable. So I move the types and I also rewrite a little the fetch function. I also rename most of the type to avoid conflict with preexisting types (like Node) and to keep consistency. --- src/ts/types/raw-data.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ts/types/raw-data.ts') diff --git a/src/ts/types/raw-data.ts b/src/ts/types/raw-data.ts index dc3db90..ae7f7c6 100644 --- a/src/ts/types/raw-data.ts +++ b/src/ts/types/raw-data.ts @@ -2,8 +2,8 @@ * Types for raw data coming from GraphQL API. */ -import { NodeResponse, PageInfo } from '@services/graphql/api'; import { ContentKind } from './app'; +import { GraphQLNode, GraphQLPageInfo } from './graphql/generics'; export type ACFPosts = { postsInThematic?: RawThematicPreview[]; @@ -37,7 +37,7 @@ export type RawAuthor = { export type RawComment = { approved: boolean; - author: NodeResponse>; + author: GraphQLNode>; content: string; databaseId: number; date: string; @@ -65,11 +65,11 @@ export type RawArticlePreview = Pick< >; export type RawPage = { - author?: NodeResponse>; + author?: GraphQLNode>; contentParts: ContentParts; databaseId: number; date: string; - featuredImage: NodeResponse | null; + featuredImage: GraphQLNode | null; info: Info; modified: string; seo?: RawSEO; @@ -101,5 +101,5 @@ export type RawTopicPreview = Pick< >; export type TotalItems = { - pageInfo: Pick; + pageInfo: Pick; }; -- cgit v1.2.3