Skip to content

Commit

Permalink
Add overloads to support passing 1 string arg to renderStatic
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremymcintyre committed Nov 1, 2024
1 parent 9968348 commit 321a055
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/PageForServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,16 @@ export class PageForServer extends Page {
});
}

renderStatic(status?: number, ns?: string) {
renderStatic(ns: string): void;
renderStatic(status: number, ns?: string): void;
renderStatic(status?: number | string, ns?: string) {
if (typeof status !== 'number') {
ns = status;
status = null;
}
this.app.emit('renderStatic', this);

if (status) this.res.statusCode = status;
if (typeof status === 'number') this.res.statusCode = status;
this.params = pageParams(this.req);
this._setRenderParams(ns);
const pageHtml = this.get('Page', ns);
Expand Down

0 comments on commit 321a055

Please sign in to comment.