mirror of
https://github.com/unraid/api.git
synced 2026-01-02 06:30:02 -06:00
refactor(api): use a type wrapper around fastify request in cookie.strategy
This commit is contained in:
@@ -2,6 +2,7 @@ import { PassportStrategy } from '@nestjs/passport';
|
||||
import { Strategy } from 'passport-custom';
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { AuthService } from './auth.service';
|
||||
import type { CustomRequest } from '../types/request';
|
||||
|
||||
const strategyName = 'user-cookie';
|
||||
|
||||
@@ -14,7 +15,7 @@ export class UserCookieStrategy extends PassportStrategy(Strategy, strategyName)
|
||||
super();
|
||||
}
|
||||
|
||||
public validate = async (req: { cookies: object }): Promise<any> => {
|
||||
public validate = async (req: CustomRequest): Promise<any> => {
|
||||
return this.authService.validateCookies(req.cookies);
|
||||
};
|
||||
}
|
||||
|
||||
3
api/src/unraid-api/types/request.ts
Normal file
3
api/src/unraid-api/types/request.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { FastifyRequest } from 'fastify';
|
||||
|
||||
export interface CustomRequest extends FastifyRequest {}
|
||||
Reference in New Issue
Block a user