refactor: 使用CurrentUser替代OSS中用的Req
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Controller, Get, Request, UseGuards } from '@nestjs/common';
|
||||
import { Controller, Get, UseGuards } from '@nestjs/common';
|
||||
import { OssService } from './oss.service';
|
||||
import { AuthGuard } from 'src/auth/guards/auth.guard';
|
||||
import { AuthUser, CurrentUser } from 'src/auth/decorator/current-user.decorator';
|
||||
|
||||
@Controller('oss')
|
||||
export class OssController {
|
||||
@@ -8,8 +9,8 @@ export class OssController {
|
||||
|
||||
@UseGuards(AuthGuard)
|
||||
@Get('sts')
|
||||
async getStsToken(@Request() req) {
|
||||
const { userId } = req.user;
|
||||
async getStsToken(@CurrentUser() user: AuthUser) {
|
||||
const { userId } = user;
|
||||
return {
|
||||
...(await this.ossService.getStsToken(`${userId}`)),
|
||||
userId,
|
||||
|
||||
Reference in New Issue
Block a user