updated codegen, added client query generation, etc.
This commit is contained in:
parent
864f37a652
commit
9518787206
17 changed files with 5244 additions and 445 deletions
43
app/client/pages/index.tsx
Normal file
43
app/client/pages/index.tsx
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import { Text, Stack } from '@chakra-ui/react';
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
|
||||
import { gql, useQuery } from '@apollo/client';
|
||||
|
||||
import { BooksManyQuery } from '@generated/types';
|
||||
|
||||
export const Route = createFileRoute('/')({
|
||||
component: Index
|
||||
});
|
||||
|
||||
function Index() {
|
||||
const { data } = useQuery<BooksManyQuery>(getBooksQuery);
|
||||
|
||||
return (
|
||||
<Stack>
|
||||
<Text>Hello world!</Text>
|
||||
<Text>This is my template!</Text>
|
||||
<Stack>
|
||||
{data && (
|
||||
<>
|
||||
{data.booksMany.map((book: any) => (
|
||||
<Stack key={book.id}>
|
||||
<Text>{book.title}</Text>
|
||||
<Text>{book.author}</Text>
|
||||
</Stack>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</Stack>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
const getBooksQuery = gql`
|
||||
query BooksMany {
|
||||
booksMany {
|
||||
id
|
||||
author
|
||||
title
|
||||
}
|
||||
}
|
||||
`;
|
||||
Loading…
Add table
Add a link
Reference in a new issue