ditch useState and composables in favour of pinia store - add server rendered note detail page
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import NotesService from '~~/lib/services/notes.service';
|
||||
import { protectedProcedure, router } from '../trpc';
|
||||
import { protectedProcedure, publicProcedure, router } from '../trpc';
|
||||
import { z } from 'zod';
|
||||
|
||||
export const notesRouter = router({
|
||||
@@ -12,4 +12,13 @@ export const notesRouter = router({
|
||||
notes,
|
||||
}
|
||||
}),
|
||||
getById: publicProcedure
|
||||
.input(z.object({ note_id: z.number() }))
|
||||
.query(async ({ ctx, input }) => {
|
||||
const notesService = new NotesService(ctx.prisma);
|
||||
const note = await notesService.getNoteById(input.note_id);
|
||||
return {
|
||||
note,
|
||||
}
|
||||
}),
|
||||
})
|
||||
Reference in New Issue
Block a user