diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index b3eb1bb..cbc862f 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -1,8 +1,7 @@ -import { Controller, Post, UseGuards, Request, Get } from '@nestjs/common'; +import { Controller, Get, Post, Request, UseGuards } from '@nestjs/common'; import { LocalAuthGuard } from './local-auth.guard'; import { AuthService } from './auth.service'; -import { JwtAuthGuard } from './jwt-auth.guard'; -import {Public} from "./public.decorator"; +import { Public } from './public.decorator'; @Controller({ path: 'auth', @@ -18,9 +17,8 @@ export class AuthController { return this.authService.login(req.user); } - @UseGuards(JwtAuthGuard) @Get('profile') getProfile(@Request() req) { - return req.user; + return this.authService.getProfile(req.user.userId); } } diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index 3e76f1c..56f4b63 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -35,4 +35,8 @@ export class AuthService { access_token: this.jwtService.sign(payload), }; } + + getProfile = async (userId: string) => { + return this.usersService.findOne(userId); + }; }