core: support response.pjax

This commit is contained in:
undefined committed 2022-11-28 18:50:16 +08:00
1 parent 89fb04bfb3
commit f08ac664da
6 files changed
+27 -48

No files matched your search

@@ -35,6 +35,9 @@ export default (logger) => async (ctx: KoaContext, next) => {
response.body = new SystemError('Serialize failure', e.message);
}
response.type = 'application/json';
} else if (response.pjax && args.pjax) {
const html = await ctx.renderHTML(response.pjax, response.body);
response.body = { fragments: [{ html }] };
} else if (response.template) {
const s = response.template.split('.');
let templateName = `${s[0]}.${args.domainId}.${s[1]}`;