You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
546 B
19 lines
546 B
import ResponseFactory from './ResponseFactory.ts'
|
|
import ViewEngine from '../../unit/ViewEngine.ts'
|
|
import {Request} from '../Request.ts'
|
|
|
|
export default class PartialViewResponseFactory extends ResponseFactory {
|
|
constructor(
|
|
public readonly view: string,
|
|
public readonly context?: any,
|
|
) {
|
|
super()
|
|
}
|
|
|
|
public async write(request: Request) {
|
|
const views: ViewEngine = this.make(ViewEngine)
|
|
request.response.body = await views.partial(this.view, this.context)
|
|
return request
|
|
}
|
|
}
|