54 lines
977 B
TypeScript
54 lines
977 B
TypeScript
import { gql } from "@apollo/client";
|
|
|
|
export const BasicCategoryFragment = gql`
|
|
fragment BasicCategoryFragment on Category {
|
|
id
|
|
rowId
|
|
title
|
|
description
|
|
}
|
|
`;
|
|
|
|
export interface BasicCategoryResponse {
|
|
id: string;
|
|
rowId: number;
|
|
title: string;
|
|
description: string | null;
|
|
__typename: "Category";
|
|
}
|
|
|
|
export const GET_ALL_CATEGORIES = gql`
|
|
query AllCategories {
|
|
allCategories {
|
|
nodes {
|
|
...BasicCategoryFragment
|
|
}
|
|
}
|
|
}
|
|
${BasicCategoryFragment}
|
|
`;
|
|
|
|
export interface GetAllCategoriesResponse {
|
|
allCategories: {
|
|
nodes: Array<BasicCategoryResponse>;
|
|
__typename: "CategoriesConnection";
|
|
};
|
|
}
|
|
|
|
export const GET_CATEGORY_BY_ID = gql`
|
|
query GetCategoryById($id: ID!) {
|
|
category(id: $id) {
|
|
...BasicCategoryFragment
|
|
}
|
|
}
|
|
${BasicCategoryFragment}
|
|
`;
|
|
|
|
export interface GetCategoryByIdResponse {
|
|
category: BasicCategoryResponse | null;
|
|
}
|
|
|
|
export interface GetCategoryByIdVariables {
|
|
id: string;
|
|
}
|