Browse Source

fix: user/me api correction

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5444/head
Pranav C 2 years ago
parent
commit
585e87c8df
  1. 5
      packages/nocodb-nest/src/modules/auth/auth.controller.ts
  2. 4
      packages/nocodb-nest/src/modules/users/users.controller.ts

5
packages/nocodb-nest/src/modules/auth/auth.controller.ts

@ -1,3 +1,4 @@
import { ExtractProjectIdMiddleware } from '../../middlewares/extract-project-id/extract-project-id.middleware'
import extractRolesObj from '../../utils/extractRolesObj' import extractRolesObj from '../../utils/extractRolesObj'
import { AuthService } from './auth.service'; import { AuthService } from './auth.service';
@ -29,9 +30,7 @@ export class AuthController {
} }
@UseGuards(ExtractProjectIdMiddleware, AuthGuard('jwt'))
@UseGuards(AuthGuard('jwt'))
@Get('/api/v1/auth/user/me') @Get('/api/v1/auth/user/me')
async me(@Request() req) { async me(@Request() req) {
const user = { const user = {

4
packages/nocodb-nest/src/modules/users/users.controller.ts

@ -10,7 +10,7 @@ import {
} from '@nestjs/common'; } from '@nestjs/common';
import { promisify } from 'util'; import { promisify } from 'util';
import { NcError } from '../../helpers/catchError'; import { NcError } from '../../helpers/catchError';
import { Acl } from '../../middlewares/extract-project-id/extract-project-id.middleware'; import { Acl, ExtractProjectIdMiddleware } from '../../middlewares/extract-project-id/extract-project-id.middleware'
import Noco from '../../Noco'; import Noco from '../../Noco';
import extractRolesObj from '../../utils/extractRolesObj'; import extractRolesObj from '../../utils/extractRolesObj';
import { genJwt, randomTokenString, setTokenCookie } from './helpers'; import { genJwt, randomTokenString, setTokenCookie } from './helpers';
@ -134,7 +134,7 @@ export class UsersController {
} }
@Get(['/auth/user/me', '/api/v1/db/auth/user/me', '/api/v1/auth/user/me']) @Get(['/auth/user/me', '/api/v1/db/auth/user/me', '/api/v1/auth/user/me'])
@UseGuards(AuthGuard('jwt')) @UseGuards(ExtractProjectIdMiddleware, AuthGuard('jwt'))
async me(@Request() req) { async me(@Request() req) {
const user = { const user = {
...req.user, ...req.user,

Loading…
Cancel
Save