1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2025-01-03 12:34:20 +00:00

Remove res parameter from authorizeUser

This commit is contained in:
Steffo 2022-05-31 16:39:30 +02:00
parent 6a9aca18b5
commit bf0e1bdc8c
Signed by: steffo
GPG key ID: 6965406171929D01
3 changed files with 3 additions and 3 deletions

View file

@ -10,7 +10,7 @@ import { Event } from "@prisma/client";
export default async function handler(req: NextApiRequest, res: NextApiResponse<ApiResult<Event | Event[]>>) { export default async function handler(req: NextApiRequest, res: NextApiResponse<ApiResult<Event | Event[]>>) {
handleInterrupts(res, async () => { handleInterrupts(res, async () => {
const user = await authorizeUser(req, res) const user = await authorizeUser(req)
const canEdit = async (_model: Model, obj?: Event) => { const canEdit = async (_model: Model, obj?: Event) => {
if(obj && obj.creatorId !== user.id) { if(obj && obj.creatorId !== user.id) {

View file

@ -9,7 +9,7 @@ import { Event } from "@prisma/client";
export default async function handler(req: NextApiRequest, res: NextApiResponse<ApiResult<Event | Event[]>>) { export default async function handler(req: NextApiRequest, res: NextApiResponse<ApiResult<Event | Event[]>>) {
handleInterrupts(res, async () => { handleInterrupts(res, async () => {
const user = await authorizeUser(req, res) const user = await authorizeUser(req)
const where = { const where = {
creatorId: user.id creatorId: user.id

View file

@ -4,7 +4,7 @@ import { client } from "./prismaClient"
import { Interrupt } from "./interrupt" import { Interrupt } from "./interrupt"
export async function authorizeUser(req: NextApiRequest, res: NextApiResponse): Promise<User> { export async function authorizeUser(req: NextApiRequest): Promise<User> {
const authorization = req.headers.authorization const authorization = req.headers.authorization
if (!authorization) { if (!authorization) {