* fixes and cleanups

* db transactions
* add default space to workspace
This commit is contained in:
Philipinho
2024-03-01 01:07:30 +00:00
parent 41ecf2d082
commit 3d90fc01ad
13 changed files with 374 additions and 121 deletions

View File

@ -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;