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:
parent
6a9aca18b5
commit
bf0e1bdc8c
3 changed files with 3 additions and 3 deletions
|
@ -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) {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue