Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 40x 139x 40x 40x |
export function extractDataAndAuthenticate<T>(req: any, res: any, ctx: any) {
const params: any = req.url.searchParams.toString().split('&').reduce((prev: any, next: any) => {
return {
...prev,
[next.split('=')[0]]: next.split('=')[1]
}
}, {});
Iif (
(params.apikey && params.apikey != process.env.API_KEY && params.apikey != process.env.INDEX_API_KEY)
||
(!params.apikey)
)
throw new Error()
return params as T;
}
|