prettier fixes #16
This commit is contained in:
@@ -4,10 +4,10 @@ import NotesService from '~/lib/services/notes.service';
|
||||
|
||||
// Example API Route with query params ... /api/note?note_id=41
|
||||
export default defineProtectedEventHandler(async (event: H3Event) => {
|
||||
const queryParams = getQuery(event)
|
||||
const queryParams = getQuery(event);
|
||||
let note_id: string = '';
|
||||
if(queryParams.note_id){
|
||||
if (Array.isArray( queryParams.note_id)) {
|
||||
if (queryParams.note_id) {
|
||||
if (Array.isArray(queryParams.note_id)) {
|
||||
note_id = queryParams.note_id[0];
|
||||
} else {
|
||||
note_id = queryParams.note_id.toString();
|
||||
@@ -15,9 +15,9 @@ export default defineProtectedEventHandler(async (event: H3Event) => {
|
||||
}
|
||||
|
||||
const notesService = new NotesService();
|
||||
const note = await notesService.getNoteById(+note_id);
|
||||
const note = await notesService.getNoteById(+note_id);
|
||||
|
||||
return {
|
||||
note,
|
||||
}
|
||||
})
|
||||
note
|
||||
};
|
||||
});
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
* This is the API-handler of your app that contains all your API routes.
|
||||
* On a bigger app, you will probably want to split this file up into multiple files.
|
||||
*/
|
||||
import { createNuxtApiHandler } from "trpc-nuxt";
|
||||
import { createContext } from "~~/server/trpc/context";
|
||||
import { appRouter } from "~~/server/trpc/routers/app.router";
|
||||
import { createNuxtApiHandler } from 'trpc-nuxt';
|
||||
import { createContext } from '~~/server/trpc/context';
|
||||
import { appRouter } from '~~/server/trpc/routers/app.router';
|
||||
|
||||
// export API handler
|
||||
export default createNuxtApiHandler({
|
||||
@@ -12,5 +12,5 @@ export default createNuxtApiHandler({
|
||||
createContext: createContext,
|
||||
onError({ error }) {
|
||||
console.error(error);
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user