Browse Source

fix: add extractProjectId middleware to /me endpoint

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5764/head
Pranav C 1 year ago
parent
commit
78fdabfde7
  1. 1
      packages/nc-gui/composables/useApi/interceptors.ts
  2. 7
      packages/nocodb/src/controllers/users/users.controller.ts

1
packages/nc-gui/composables/useApi/interceptors.ts

@ -69,6 +69,7 @@ export function addAxiosInterceptors(api: Api<any>) {
await state.signOut()
// todo: handle new user
debugger
navigateTo('/signIn')
return Promise.reject(error)

7
packages/nocodb/src/controllers/users/users.controller.ts

@ -13,7 +13,10 @@ import * as ejs from 'ejs';
import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../../guards/global/global.guard';
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 { User } from '../../models';
import {
randomTokenString,
@ -96,7 +99,7 @@ export class UsersController {
}
@Get(['/auth/user/me', '/api/v1/db/auth/user/me', '/api/v1/auth/user/me'])
@UseGuards(GlobalGuard)
@UseGuards(ExtractProjectIdMiddleware, GlobalGuard)
async me(@Request() req) {
const user = {
...req.user,

Loading…
Cancel
Save