Complete Throwing Responses

This commit is contained in:
2025-04-15 22:09:22 +02:00
parent 07c29d65b7
commit e91dd6ac8d
2 changed files with 11 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
import { publicProcedure, router } from '~/server/trpc/init';
import { z } from 'zod';
import { getContacts } from "~/server/utils/data";
import { getContact, getContacts } from "~/server/utils/data";
export const appRouter = router({
hello: publicProcedure.input(
@@ -14,7 +14,12 @@ export const appRouter = router({
}),
contactList: publicProcedure.query(async () => {
return await getContacts();
})
}),
contactGet: publicProcedure.input(
z.object({ contactId: z.string() })
).query(async (opts) => {
return await getContact(opts.input.contactId);
}),
});
// export type definition of API