mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-16 20:59:26 +00:00
feat: return generated tokens on refresh
This commit is contained in:
@@ -76,10 +76,10 @@ export class AuthController {
|
|||||||
@ApiOperation({ description: 'Update current user data.', summary: 'Update user data' })
|
@ApiOperation({ description: 'Update current user data.', summary: 'Update user data' })
|
||||||
@ApiUnauthorizedResponse({ description: 'Not logged in' })
|
@ApiUnauthorizedResponse({ description: 'Not logged in' })
|
||||||
@ApiBadRequestResponse({ description: 'User not found' })
|
@ApiBadRequestResponse({ description: 'User not found' })
|
||||||
|
@ApiBearerAuth()
|
||||||
@UseInterceptors(FileFieldsInterceptor([{ name: 'avatar', maxCount: 1 }]))
|
@UseInterceptors(FileFieldsInterceptor([{ name: 'avatar', maxCount: 1 }]))
|
||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Patch('me')
|
@Patch('me')
|
||||||
@ApiBearerAuth()
|
|
||||||
async updateUserData(
|
async updateUserData(
|
||||||
@Request() req,
|
@Request() req,
|
||||||
@UploadedFiles()
|
@UploadedFiles()
|
||||||
@@ -210,8 +210,15 @@ export class AuthController {
|
|||||||
sameSite: 'none',
|
sameSite: 'none',
|
||||||
secure: true,
|
secure: true,
|
||||||
})
|
})
|
||||||
|
res.send({
|
||||||
|
accessToken: newTokens.accessToken,
|
||||||
|
refreshToken: newTokens.refreshToken,
|
||||||
|
})
|
||||||
|
|
||||||
return { accessToken: newTokens.accessToken, refreshToken: newTokens.refreshToken }
|
return {
|
||||||
|
accessToken: newTokens.accessToken,
|
||||||
|
refreshToken: newTokens.refreshToken,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation({
|
@ApiOperation({
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ import {
|
|||||||
PaginatedDecksWithMaxCardsCount,
|
PaginatedDecksWithMaxCardsCount,
|
||||||
} from './entities/deck.entity'
|
} from './entities/deck.entity'
|
||||||
import { MinMaxCards } from './entities/min-max-cards.entity'
|
import { MinMaxCards } from './entities/min-max-cards.entity'
|
||||||
import { DecksRepository } from './infrastructure/decks.repository'
|
|
||||||
import {
|
import {
|
||||||
CreateCardCommand,
|
CreateCardCommand,
|
||||||
CreateDeckCommand,
|
CreateDeckCommand,
|
||||||
|
|||||||
Reference in New Issue
Block a user