File

apps/api/src/auth/session.serializer.ts

Extends

PassportSerializer

Index

Methods

Methods

deserializeUser
deserializeUser(payload, done: (err: Error | null,undefined) => void)
Parameters :
Name Type Optional
payload No
done function No
Returns : void
serializeUser
serializeUser(user: UserEntity, done: (err: Error | null,id: UserEntity) => void)
Parameters :
Name Type Optional
user UserEntity No
done function No
Returns : void
import { Injectable } from '@nestjs/common'
import { PassportSerializer } from '@nestjs/passport'
import { UserEntity } from '../entities/user.entity'

@Injectable()
export class SessionSerializer extends PassportSerializer {
  serializeUser(
    user: UserEntity,
    done: (err: Error | null, id?: UserEntity) => void
  ): void {
    done(null, user)
  }

  deserializeUser(
    payload: unknown,
    done: (err: Error | null, payload?: unknown) => void
  ): void {
    done(null, payload)
  }
}

results matching ""

    No results matching ""