mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-19 03:01:10 +10:00
* fixes and cleanups
* db transactions * add default space to workspace
This commit is contained in:
@ -35,13 +35,19 @@ export class JwtGuard implements CanActivate {
|
||||
throw new UnauthorizedException('Invalid jwt token');
|
||||
}
|
||||
|
||||
try {
|
||||
const payload = await this.tokenService.verifyJwt(token);
|
||||
let payload;
|
||||
|
||||
try {
|
||||
payload = await this.tokenService.verifyJwt(token);
|
||||
} catch (error) {
|
||||
throw new UnauthorizedException('Could not verify jwt token');
|
||||
}
|
||||
|
||||
try {
|
||||
//fetch user and current workspace data from db
|
||||
request['user'] = await this.userService.getUserInstance(payload.sub);
|
||||
} catch (error) {
|
||||
throw new UnauthorizedException('Could not verify jwt token');
|
||||
throw new UnauthorizedException(error.message);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user