import { Controller, Get, Session, UnauthorizedException } from '@nestjs/common';
import { AuthService } from './auth.service';
import { user_account } from '../../common/types/user.types';
@Controller('auth')
export class AuthController {
constructor(private readonly authService: AuthService) {}
@Get('check-login')
async checkLoginState(@Session() session: Record<string, any>): Promise<user_account> {
const sessionId = session.sessionID;
if (!sessionId) {
throw new UnauthorizedException('로그인을 진행하여 주세요.');
}
return this.authService.checkLoginState(sessionId);
}
}
맞는 코드를 작성하였는데도 @Get('check-login') 부분에서에서 오류라 인식하였다.
해결 방법
> 터미널에 npx tsc 입력
tsconfig.json 수정 후 갱신하지 않아서 오류가 발생하였던 것 같다..
'Web > Node.js & Nest.js' 카테고리의 다른 글
@nestjs/typeorm에서 ReferenceError: crypto is not defined 오류 (0) | 2025.01.29 |
---|---|
[리팩토링 - Node] 타입스크립트로 마이그레이션하며 소스 정리(진행 중) (0) | 2025.01.04 |
[centos7] Node 배포하기, 리액트와 연결하기 (2) | 2024.09.18 |
createConnection이 8시간마다 끊기는 문제 (0) | 2024.09.17 |
[Node]Like문 쿼리 조회하기 (0) | 2024.09.15 |