diff --git a/src/server/api/routers/notebook.ts b/src/server/api/routers/notebook.ts index c0df1beb1..d7eb065cb 100644 --- a/src/server/api/routers/notebook.ts +++ b/src/server/api/routers/notebook.ts @@ -12,13 +12,20 @@ export const notebookRouter = createTRPCRouter({ update: publicProcedure .input(z.object({ widgetId: z.string(), content: z.string(), configName: z.string() })) .mutation(async ({ input }) => { + if (!process.env.DISABLE_EDIT_MODE) { + throw new TRPCError({ + code: 'METHOD_NOT_SUPPORTED', + message: 'Edit is not allowed, because edit mode is disabled' + }); + } + const config = getConfig(input.configName); const widget = config.widgets.find((widget) => widget.id === input.widgetId) as | INotebookWidget | undefined; if (!widget) { - return new TRPCError({ + throw new TRPCError({ code: 'BAD_REQUEST', message: 'Specified widget was not found', });