webspresso 0.0.82 → 0.0.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -227,28 +227,36 @@ function wrapCustomPageWithLayout(page, rawComp) {
|
|
|
227
227
|
|
|
228
228
|
return {
|
|
229
229
|
oninit: function(vnode) {
|
|
230
|
-
|
|
230
|
+
vnode.state.instance = typeof rawComp === 'function' ? rawComp.call(this, vnode) : rawComp;
|
|
231
|
+
if (vnode.state.instance && typeof vnode.state.instance.oninit === 'function') {
|
|
232
|
+
return vnode.state.instance.oninit.call(this, vnode);
|
|
233
|
+
}
|
|
231
234
|
},
|
|
232
235
|
oncreate: function(vnode) {
|
|
233
|
-
|
|
236
|
+
const comp = vnode.state.instance || rawComp;
|
|
237
|
+
if (comp && typeof comp.oncreate === 'function') return comp.oncreate.call(this, vnode);
|
|
234
238
|
},
|
|
235
239
|
onupdate: function(vnode) {
|
|
236
|
-
|
|
240
|
+
const comp = vnode.state.instance || rawComp;
|
|
241
|
+
if (comp && typeof comp.onupdate === 'function') return comp.onupdate.call(this, vnode);
|
|
237
242
|
},
|
|
238
243
|
onbeforeremove: function(vnode) {
|
|
239
|
-
|
|
244
|
+
const comp = vnode.state.instance || rawComp;
|
|
245
|
+
if (comp && typeof comp.onbeforeremove === 'function') return comp.onbeforeremove.call(this, vnode);
|
|
240
246
|
},
|
|
241
247
|
onremove: function(vnode) {
|
|
242
|
-
|
|
248
|
+
const comp = vnode.state.instance || rawComp;
|
|
249
|
+
if (comp && typeof comp.onremove === 'function') return comp.onremove.call(this, vnode);
|
|
243
250
|
},
|
|
244
251
|
view: function(vnode) {
|
|
252
|
+
const comp = vnode.state.instance || rawComp;
|
|
245
253
|
var content;
|
|
246
|
-
if (typeof
|
|
247
|
-
content =
|
|
248
|
-
} else if (typeof
|
|
249
|
-
content =
|
|
254
|
+
if (comp && typeof comp.view === 'function') {
|
|
255
|
+
content = comp.view.call(this, vnode);
|
|
256
|
+
} else if (typeof comp === 'function') {
|
|
257
|
+
content = comp.call(this, vnode);
|
|
250
258
|
} else {
|
|
251
|
-
content =
|
|
259
|
+
content = comp;
|
|
252
260
|
}
|
|
253
261
|
if (content && (content.tag === Layout || (content.tag && content.tag.name === 'Layout'))) {
|
|
254
262
|
return content;
|
|
@@ -265,7 +265,20 @@ function registerApiRoutes(moduleId, apiConfig, deps) {
|
|
|
265
265
|
const useAuth = route.auth !== undefined ? route.auth : defaultAuth;
|
|
266
266
|
const authMiddleware = useAuth ? requireAuth : optionalAuth;
|
|
267
267
|
|
|
268
|
-
|
|
268
|
+
const safeHandler = async (req, res, next) => {
|
|
269
|
+
try {
|
|
270
|
+
await route.handler(req, res, next);
|
|
271
|
+
} catch (err) {
|
|
272
|
+
if (typeof next === 'function') {
|
|
273
|
+
next(err);
|
|
274
|
+
} else {
|
|
275
|
+
throw err;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
safeHandler._originalHandler = route.handler;
|
|
280
|
+
|
|
281
|
+
ctx.addRoute(method, fullPath, authMiddleware, safeHandler);
|
|
269
282
|
}
|
|
270
283
|
}
|
|
271
284
|
|
|
@@ -34,9 +34,11 @@ function generateAuditLogComponent(options = {}) {
|
|
|
34
34
|
rows = res.data || [];
|
|
35
35
|
total = (res.meta && res.meta.total) || 0;
|
|
36
36
|
loading = false;
|
|
37
|
+
if (typeof m !== 'undefined' && m.redraw) m.redraw();
|
|
37
38
|
}).catch(function(e) {
|
|
38
39
|
error = e.message || String(e);
|
|
39
40
|
loading = false;
|
|
41
|
+
if (typeof m !== 'undefined' && m.redraw) m.redraw();
|
|
40
42
|
});
|
|
41
43
|
}
|
|
42
44
|
|