Solved issue with non-existing search pages

This commit is contained in:
lotte
2019-06-18 08:58:35 +02:00
parent 37fd04593b
commit bb76015aa1
47 changed files with 99 additions and 62 deletions

View File

@@ -0,0 +1,26 @@
import { RESPONSE } from '@nguniversal/express-engine/tokens';
import { Inject, Injectable, Optional } from '@angular/core';
import { Response } from 'express';
@Injectable()
export class ServerResponseService {
private response: Response;
constructor(@Optional() @Inject(RESPONSE) response: any) {
this.response = response;
}
setStatus(code: number, message?: string): this {
if (this.response) {
this.response.statusCode = code;
if (message) {
this.response.statusMessage = message;
}
}
return this;
}
setNotFound(message = 'Not found'): this {
return this.setStatus(404, message)
}
}