fix: check is user login

pull/26/head
fantasticit 2022-04-11 22:06:45 +08:00
parent fb16c0a0e9
commit 806467c5e4
1 changed files with 4 additions and 0 deletions

View File

@ -34,6 +34,10 @@ export class WikiUserRoleGuard implements CanActivate {
const user = this.jwtService.decode(token) as IUser;
if (!user) {
throw new HttpException('请登录', HttpStatus.UNAUTHORIZED);
}
const { params, query, body } = request;
const wikiId = params?.id || params?.wikiId || query?.id || query?.wikiId || body?.wikiId;