fix: fix js error

This commit is contained in:
fantasticit 2022-04-11 22:01:51 +08:00
parent b598c33fc5
commit 85a79127b0
4 changed files with 5 additions and 4 deletions

View File

@ -32,7 +32,8 @@ export class DocumentAuthorityGuard implements CanActivate {
const user = this.jwtService.decode(token) as IUser;
const { params, query, body } = request;
const documentId = params.id || params.documentId || query.id || query.documentId || body.documentId;
const documentId = params?.id || params?.documentId || query?.id || query?.documentId || body?.documentId;
let document = null;
if (documentId) {

View File

@ -19,7 +19,7 @@ export class DocumentStatusGuard implements CanActivate {
const request = context.switchToHttp().getRequest();
const { params, query, body } = request;
const documentId = params.id || params.documentId || query.id || query.documentId || body.documentId;
const documentId = params?.id || params?.documentId || query?.id || query?.documentId || body?.documentId;
let document = null;

View File

@ -19,7 +19,7 @@ export class WikiStatusGuard implements CanActivate {
const request = context.switchToHttp().getRequest();
const { params, query, body } = request;
const wikiId = params.id || params.wikiId || query.id || query.wikiId || body.wikiId;
const wikiId = params?.id || params?.wikiId || query?.id || query?.wikiId || body?.wikiId;
const wiki = await this.wikiService.findById(wikiId);

View File

@ -35,7 +35,7 @@ export class WikiUserRoleGuard implements CanActivate {
const user = this.jwtService.decode(token) as IUser;
const { params, query, body } = request;
const wikiId = params.id || params.wikiId || query.id || query.wikiId || body.wikiId;
const wikiId = params?.id || params?.wikiId || query?.id || query?.wikiId || body?.wikiId;
const wiki = await this.wikiService.findById(wikiId);