Skip to content

Commit 1eabaa8

Browse files
committed
chore: debug
1 parent 031f20f commit 1eabaa8

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

commitlint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = { extends: ['@commitlint/config-conventional'] };
1+
module.exports = { extends: ['@commitlint/config-conventional'] }

src/auth/auth/auth.controller.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import {
66
HttpStatus,
77
Post,
88
Req,
9+
Res,
910
UseGuards,
1011
} from '@nestjs/common'
1112

1213
import { AuthService } from './auth.service'
1314
import { AuthDto } from './dto'
1415
import { AtGuard } from './guards'
1516
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger'
16-
import { Request } from 'express'
17+
import { Request, Response } from 'express'
1718

1819
@Controller('auth')
1920
export class AuthController {
@@ -30,16 +31,24 @@ export class AuthController {
3031
@ApiTags('Auth')
3132
@ApiOperation({ summary: 'Sign in' })
3233
@Post('login')
34+
@HttpCode(200)
3335
@HttpCode(HttpStatus.OK)
34-
async signinLocal(@Body() dto: AuthDto, @Req() req: Request): Promise<any> {
35-
return await this.authService.signinLocal(dto, req)
36+
async signinLocal(
37+
@Body() dto: AuthDto,
38+
@Req() req: Request,
39+
@Res() res: Response,
40+
): Promise<any> {
41+
console.log('attempt auth')
42+
await this.authService.signinLocal(dto, req)
43+
return res.redirect('/auth/status')
3644
}
3745

3846
@ApiTags('Auth')
3947
@ApiOperation({ summary: 'Get session status' })
4048
@ApiBearerAuth()
4149
@Get('status')
4250
@UseGuards(AtGuard)
51+
@HttpCode(200)
4352
async status(@Req() req: Request) {
4453
return req.session.user
4554
}

src/auth/auth/guards/at.guard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class AtGuard {
1414
context.getHandler(),
1515
context.getClass(),
1616
])
17-
17+
console.log('auth seccues')
1818
if (isPublic) return true
1919

2020
const request = context.switchToHttp().getRequest()

src/main.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ async function bootstrap() {
3131
SwaggerModule.setup('api', app, document)
3232

3333
app.enableCors({
34-
origin: 'http://localhost:3000',
35-
methods: 'GET,POST,PUT,DELETE',
36-
allowedHeaders: 'Content-Type, Authorization',
34+
origin: ['http://127.0.0.1:9000', 'http://localhost:9000'],
35+
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
3736
credentials: true,
3837
})
3938

0 commit comments

Comments
 (0)