You've already forked obsidian-visualiser
Spell UI, variables saving and mail server fixes (finally working in prod !!!)
This commit is contained in:
@@ -4,7 +4,11 @@ declare module 'nitropack'
|
||||
{
|
||||
interface TaskPayload
|
||||
{
|
||||
type: string
|
||||
type: string;
|
||||
}
|
||||
interface TaskResult<RT = unknown>
|
||||
{
|
||||
error?: Error | string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +21,7 @@ export default defineEventHandler(async (e) => {
|
||||
return;
|
||||
}
|
||||
const id = getRouterParam(e, 'id');
|
||||
const payload: Record<string, any> = await readBody(e);
|
||||
const body: Record<string, any> = await readBody(e);
|
||||
|
||||
if(!id)
|
||||
{
|
||||
@@ -25,8 +29,11 @@ export default defineEventHandler(async (e) => {
|
||||
return;
|
||||
}
|
||||
|
||||
payload.type = id;
|
||||
payload.data = JSON.parse(payload.data);
|
||||
body.data = JSON.parse(body.data);
|
||||
const payload = {
|
||||
type: id,
|
||||
data: body,
|
||||
}
|
||||
|
||||
const result = await runTask(id, {
|
||||
payload: payload
|
||||
@@ -36,7 +43,7 @@ export default defineEventHandler(async (e) => {
|
||||
{
|
||||
setResponseStatus(e, 500);
|
||||
|
||||
if(result.error && (result.error as Error).message)
|
||||
if(result.error && result.error.message)
|
||||
throw result.error;
|
||||
else if(result.error)
|
||||
throw new Error(result.error);
|
||||
|
||||
Reference in New Issue
Block a user