add api.runAsyncOnBackendWithManualTransactionHandling() variant and add toast warnings about improper usage.

This commit is contained in:
zadam
2023-10-29 00:51:23 +02:00
parent 4660c154e9
commit 48e98b2ac3
3 changed files with 64 additions and 18 deletions

View File

@@ -302,7 +302,8 @@ function register(app) {
apiRoute(GET, '/api/database/check-integrity', databaseRoute.checkIntegrity);
apiRoute(PST, '/api/script/exec', scriptRoute.exec);
route(PST, '/api/script/exec', [auth.checkApiAuth, csrfMiddleware], scriptRoute.exec, apiResultHandler, false);
apiRoute(PST, '/api/script/run/:noteId', scriptRoute.run);
apiRoute(GET, '/api/script/startup', scriptRoute.getStartupBundles);
apiRoute(GET, '/api/script/widgets', scriptRoute.getWidgetBundles);
@@ -449,7 +450,7 @@ function route(method, path, middleware, routeHandler, resultHandler = null, tra
return;
}
if (result && result.then) { // promise
if (result?.then) { // promise
result
.then(promiseResult => handleResponse(resultHandler, req, res, promiseResult, start))
.catch(e => handleException(e, method, path, res));