ditch useState and composables in favour of pinia store - add server rendered note detail page

This commit is contained in:
Michael Dausmann
2023-02-19 01:22:55 +11:00
parent bb9f4dfd1d
commit b3ee03b5c3
10 changed files with 325 additions and 539 deletions

View File

@@ -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,
}
}),
})