refactor: rename gql documents
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import gql from "graphql-tag";
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const categoriesListDocument = gql`
|
||||
query CategoriesList {
|
||||
categories {
|
||||
query CategoriesList($group: String) {
|
||||
categories(filters: { group: { eq: $group } }) {
|
||||
documentId
|
||||
slug
|
||||
title
|
||||
@@ -11,4 +11,4 @@ export const categoriesListDocument = gql`
|
||||
badge
|
||||
}
|
||||
}
|
||||
`;
|
||||
`
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
import type { ExecutionResult } from "graphql";
|
||||
|
||||
import { execute } from "../graphql/execute";
|
||||
import type { HomePageQueryQuery, HomePageQueryQueryVariables } from "../graphql/graphql";
|
||||
import type { HomePageQuery, HomePageQueryVariables } from "../graphql/graphql";
|
||||
import { homePageDocument } from "./home-page.gql";
|
||||
|
||||
export const homePageQueryQuery = {
|
||||
async execute(variables?: HomePageQueryQueryVariables): Promise<ExecutionResult<HomePageQueryQuery>> {
|
||||
return execute<HomePageQueryQuery, HomePageQueryQueryVariables>(homePageDocument, variables);
|
||||
export const homePageQuery = {
|
||||
async execute(variables?: HomePageQueryVariables): Promise<ExecutionResult<HomePageQuery>> {
|
||||
return execute<HomePageQuery, HomePageQueryVariables>(homePageDocument, variables);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const homePageDocument = gql`
|
||||
query HomePageQuery {
|
||||
query HomePage {
|
||||
homePage {
|
||||
sections {
|
||||
__typename
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
import type { ExecutionResult } from "graphql";
|
||||
|
||||
import { execute } from "../graphql/execute";
|
||||
import type { SiteConfigQueryQuery, SiteConfigQueryQueryVariables } from "../graphql/graphql";
|
||||
import type { SiteConfigQuery, SiteConfigQueryVariables } from "../graphql/graphql";
|
||||
import { siteConfigDocument } from "./site-config.gql";
|
||||
|
||||
export const siteConfigQueryQuery = {
|
||||
async execute(variables?: SiteConfigQueryQueryVariables): Promise<ExecutionResult<SiteConfigQueryQuery>> {
|
||||
return execute<SiteConfigQueryQuery, SiteConfigQueryQueryVariables>(siteConfigDocument, variables);
|
||||
export const siteConfigQuery = {
|
||||
async execute(variables?: SiteConfigQueryVariables): Promise<ExecutionResult<SiteConfigQuery>> {
|
||||
return execute<SiteConfigQuery, SiteConfigQueryVariables>(siteConfigDocument, variables);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const siteConfigDocument = gql`
|
||||
query SiteConfigQuery {
|
||||
query SiteConfig {
|
||||
siteConfig {
|
||||
title
|
||||
description
|
||||
|
||||
@@ -1554,15 +1554,17 @@ export type VendorRelationResponseCollection = {
|
||||
nodes: Array<Vendor>;
|
||||
};
|
||||
|
||||
export type CategoriesListQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
export type CategoriesListQueryVariables = Exact<{
|
||||
group?: InputMaybe<Scalars['String']['input']>;
|
||||
}>;
|
||||
|
||||
|
||||
export type CategoriesListQuery = { __typename?: 'Query', categories: Array<{ __typename?: 'Category', documentId: string, slug: string, title?: string | null, sortOrder: number, group: Enum_Category_Group, badge?: string | null } | null> };
|
||||
|
||||
export type HomePageQueryQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
export type HomePageQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type HomePageQueryQuery = { __typename?: 'Query', homePage?: { __typename?: 'HomePage', sections?: Array<
|
||||
export type HomePageQuery = { __typename?: 'Query', homePage?: { __typename?: 'HomePage', sections?: Array<
|
||||
| { __typename: 'ComponentSectionsAbout', id: string, title?: string | null, description?: string | null, partners?: Array<{ __typename?: 'ComponentSharedString', id: string, value: string } | null> | null, cards?: Array<{ __typename?: 'ComponentCardsAdvantage', id: string, title?: string | null, description?: string | null, color?: { __typename?: 'ComponentSharedColor', value?: Enum_Componentsharedcolor_Value | null } | null, icon?: { __typename?: 'ComponentSharedIcon', value?: Enum_Componentsharedicon_Value | null } | null } | null> | null }
|
||||
| { __typename: 'ComponentSectionsCases', id: string, title?: string | null, description?: string | null, cards?: Array<{ __typename?: 'ComponentCardsCase', id: string, title?: string | null, description?: string | null, pretitle?: string | null, badge?: string | null, footnote?: string | null, color?: { __typename?: 'ComponentSharedColor', value?: Enum_Componentsharedcolor_Value | null } | null, icon?: { __typename?: 'ComponentSharedIcon', value?: Enum_Componentsharedicon_Value | null } | null } | null> | null }
|
||||
| { __typename: 'ComponentSectionsHomeHero', id: string, title?: string | null, description?: string | null, badge?: string | null, stats?: Array<{ __typename?: 'ComponentSharedAttribute', id: string, key?: string | null, value?: string | null } | null> | null }
|
||||
@@ -1571,10 +1573,10 @@ export type HomePageQueryQuery = { __typename?: 'Query', homePage?: { __typename
|
||||
| { __typename: 'Error' }
|
||||
| null> | null } | null };
|
||||
|
||||
export type SiteConfigQueryQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
export type SiteConfigQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type SiteConfigQueryQuery = { __typename?: 'Query', siteConfig?: { __typename?: 'SiteConfig', title: string, description?: string | null, contacts?: Array<{ __typename?: 'ComponentSharedContact', id: string, type: Enum_Componentsharedcontact_Type, value: string, displayValue?: string | null } | null> | null } | null };
|
||||
export type SiteConfigQuery = { __typename?: 'Query', siteConfig?: { __typename?: 'SiteConfig', title: string, description?: string | null, contacts?: Array<{ __typename?: 'ComponentSharedContact', id: string, type: Enum_Componentsharedcontact_Type, value: string, displayValue?: string | null } | null> | null } | null };
|
||||
|
||||
export class TypedDocumentString<TResult, TVariables>
|
||||
extends String
|
||||
@@ -1596,8 +1598,8 @@ export class TypedDocumentString<TResult, TVariables>
|
||||
}
|
||||
|
||||
export const CategoriesListDocument = new TypedDocumentString(`
|
||||
query CategoriesList {
|
||||
categories {
|
||||
query CategoriesList($group: String) {
|
||||
categories(filters: {group: {eq: $group}}) {
|
||||
documentId
|
||||
slug
|
||||
title
|
||||
@@ -1607,8 +1609,8 @@ export const CategoriesListDocument = new TypedDocumentString(`
|
||||
}
|
||||
}
|
||||
`) as unknown as TypedDocumentString<CategoriesListQuery, CategoriesListQueryVariables>;
|
||||
export const HomePageQueryDocument = new TypedDocumentString(`
|
||||
query HomePageQuery {
|
||||
export const HomePageDocument = new TypedDocumentString(`
|
||||
query HomePage {
|
||||
homePage {
|
||||
sections {
|
||||
__typename
|
||||
@@ -1701,9 +1703,9 @@ export const HomePageQueryDocument = new TypedDocumentString(`
|
||||
}
|
||||
}
|
||||
}
|
||||
`) as unknown as TypedDocumentString<HomePageQueryQuery, HomePageQueryQueryVariables>;
|
||||
export const SiteConfigQueryDocument = new TypedDocumentString(`
|
||||
query SiteConfigQuery {
|
||||
`) as unknown as TypedDocumentString<HomePageQuery, HomePageQueryVariables>;
|
||||
export const SiteConfigDocument = new TypedDocumentString(`
|
||||
query SiteConfig {
|
||||
siteConfig {
|
||||
title
|
||||
description
|
||||
@@ -1715,4 +1717,4 @@ export const SiteConfigQueryDocument = new TypedDocumentString(`
|
||||
}
|
||||
}
|
||||
}
|
||||
`) as unknown as TypedDocumentString<SiteConfigQueryQuery, SiteConfigQueryQueryVariables>;
|
||||
`) as unknown as TypedDocumentString<SiteConfigQuery, SiteConfigQueryVariables>;
|
||||
@@ -1,5 +1,3 @@
|
||||
import type { SiteConfigQueryQuery } from '../../../graphql/graphql'
|
||||
import type { SiteConfigQuery } from '../../../graphql/graphql'
|
||||
|
||||
export type SiteConfigContact = NonNullable<
|
||||
NonNullable<NonNullable<SiteConfigQueryQuery['siteConfig']>['contacts']>[number]
|
||||
>
|
||||
export type SiteConfigContact = NonNullable<NonNullable<NonNullable<SiteConfigQuery['siteConfig']>['contacts']>[number]>
|
||||
|
||||
@@ -6,11 +6,11 @@ import { Header } from '../sections/Header'
|
||||
import { Footer } from '../sections/Footer'
|
||||
import { CategoryView } from '../views/CategoryView'
|
||||
import type { SiteConfigContact } from '../lib/cms/contact/types'
|
||||
import { siteConfigQueryQuery } from '../graphql-documents/site-config.gql.generated'
|
||||
import { siteConfigQuery } from '../graphql-documents/site-config.gql.generated'
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const categories = await getCollection('categories')
|
||||
const siteResult = await siteConfigQueryQuery.execute()
|
||||
const siteResult = await siteConfigQuery.execute()
|
||||
if (siteResult.errors?.length) {
|
||||
throw new Error(siteResult.errors.map(e => e.message).join(', '))
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ import '../styles/globals.css'
|
||||
import { Header } from '../sections/Header'
|
||||
import { Footer } from '../sections/Footer'
|
||||
import { HomePage } from '../views/HomePage'
|
||||
import { homePageQueryQuery } from '../graphql-documents/home-page.gql.generated'
|
||||
import { siteConfigQueryQuery } from '../graphql-documents/site-config.gql.generated'
|
||||
import { homePageQuery } from '../graphql-documents/home-page.gql.generated'
|
||||
import { siteConfigQuery } from '../graphql-documents/site-config.gql.generated'
|
||||
|
||||
const [homeResult, siteResult] = await Promise.all([
|
||||
homePageQueryQuery.execute(),
|
||||
siteConfigQueryQuery.execute(),
|
||||
homePageQuery.execute(),
|
||||
siteConfigQuery.execute(),
|
||||
])
|
||||
|
||||
if (homeResult.errors?.length) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import type { HomePageQueryQuery } from '../graphql/graphql'
|
||||
import type { HomePageQuery } from '../graphql/graphql'
|
||||
import { Hero } from '../sections/Hero'
|
||||
import { Services } from '../sections/Services'
|
||||
import { Solutions } from '../sections/Solutions'
|
||||
@@ -13,7 +13,7 @@ import type { Maybe } from '../lib/types'
|
||||
|
||||
const HEADER_OFFSET_PX = 85
|
||||
|
||||
type HomePageData = NonNullable<HomePageQueryQuery['homePage']>
|
||||
type HomePageData = NonNullable<HomePageQuery['homePage']>
|
||||
type HomeSection = NonNullable<NonNullable<HomePageData['sections']>[number]>
|
||||
|
||||
type HeroSection = Extract<HomeSection, { __typename?: 'ComponentSectionsHomeHero' }>
|
||||
|
||||
Reference in New Issue
Block a user