mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
define context interface
This commit is contained in:
parent
a5e10c2ed9
commit
7ec35bbfb2
@ -1,9 +1,18 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import { Role } from '@/auth/Role'
|
||||
import { User as dbUser } from '@entity/User'
|
||||
|
||||
const context = (args: any) => {
|
||||
export interface Context {
|
||||
token: string | null
|
||||
setHeaders: { key: string, value: string }[]
|
||||
role?: Role
|
||||
user?: dbUser
|
||||
}
|
||||
|
||||
const context = (args: any): Context => {
|
||||
const authorization = args.req.headers.authorization
|
||||
let token = null
|
||||
let token: string | null = null
|
||||
if (authorization) {
|
||||
token = authorization.replace(/^Bearer /, '')
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user