|
@@ -1,4 +1,4 @@
|
|
|
-import { Controller, Post, Body } from '@nestjs/common';
|
|
|
+import { Controller, Post, Body, Headers } from '@nestjs/common';
|
|
|
import { AuthService } from './auth.service';
|
|
|
|
|
|
interface AuthBody {
|
|
@@ -22,4 +22,17 @@ export class AuthController {
|
|
|
msg: 'Wrong password',
|
|
|
};
|
|
|
}
|
|
|
+
|
|
|
+ @Post('check')
|
|
|
+ check(@Headers('Authorization') token: string) {
|
|
|
+ return this.authService.checkBearerToken(token)
|
|
|
+ ? {
|
|
|
+ code: 200,
|
|
|
+ msg: 'OK',
|
|
|
+ }
|
|
|
+ : {
|
|
|
+ code: 401,
|
|
|
+ msg: 'Unauthorized',
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|