Skip to content

Commit

Permalink
Align all templates to use publicProcedure for getLatest method
Browse files Browse the repository at this point in the history
Fixes t3-oss#1961

Fix the issue with errors on a fresh T3 app install by changing `getLatest` to use `publicProcedure` instead of `protectedProcedure`.

* **cli/template/extras/src/server/api/routers/post/with-auth.ts**
  - Change `getLatest` to use `publicProcedure` instead of `protectedProcedure`.
* **cli/template/extras/src/server/api/routers/post/with-auth-prisma.ts**
  - Change `getLatest` to use `publicProcedure` instead of `protectedProcedure`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/t3-oss/create-t3-app/issues/1961?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
Guria committed Aug 19, 2024
1 parent 4885a97 commit cbf719d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const postRouter = createTRPCRouter({
});
}),

getLatest: protectedProcedure.query(async ({ ctx }) => {
getLatest: publicProcedure.query(async ({ ctx }) => {
const post = await ctx.db.post.findFirst({
orderBy: { createdAt: "desc" },
where: { createdBy: { id: ctx.session.user.id } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const postRouter = createTRPCRouter({
return post;
}),

getLatest: protectedProcedure.query(() => {
getLatest: publicProcedure.query(() => {
return post;
}),

Expand Down

0 comments on commit cbf719d

Please sign in to comment.