Skip to content

Commit 1a8b6b4

Browse files
authored
chore: update trpc test code (#1731)
1 parent e72fbd1 commit 1a8b6b4

File tree

2 files changed

+4
-6
lines changed
  • packages/plugins/trpc/tests/projects/t3-trpc-v10/src

2 files changed

+4
-6
lines changed

packages/plugins/trpc/tests/projects/t3-trpc-v10/src/pages/index.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import styles from './index.module.css';
33

44
export default function Home() {
55
const hello = api.greet.hello.useQuery({ text: 'from tRPC' });
6-
const posts = api.post.findMany.useQuery({ where: { published: true }, include: { author: true } });
7-
const postsTransformed = api.post.findMany.useQuery(
6+
const posts = api.post.post.findMany.useQuery({ where: { published: true }, include: { author: true } });
7+
const postsTransformed = api.post.post.findMany.useQuery(
88
{},
99
{ select: (data) => data.map((p) => ({ id: p.id, title: p.name })) }
1010
);
@@ -14,9 +14,7 @@ export default function Home() {
1414
<main className={styles.main}>
1515
{hello.data && <h1 className={styles.title}>{hello.data.greeting}</h1>}
1616
{posts.data?.map((post) => (
17-
<p key={post.id}>
18-
{post.name} by {post.author.email}
19-
</p>
17+
<p key={post.id}>{post.name}</p>
2018
))}
2119
{postsTransformed.data?.map((post) => (
2220
<p key={post.id}>{post.title}</p>

packages/plugins/trpc/tests/projects/t3-trpc-v10/src/utils/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const getBaseUrl = () => {
1818
};
1919

2020
/** A set of type-safe react-query hooks for your tRPC API. */
21-
export const api = createTRPCNext<AppRouter>({
21+
export const api = createTRPCNext<AppRouter, 'post'>({
2222
config() {
2323
return {
2424
/**

0 commit comments

Comments
 (0)