Skip to content

res object issues on Event functions #590

@ozziest

Description

@ozziest

Currently, Events uses the same parameter types as Hooks. That doesn't make sense. In Hooks, developers can return an HTTP response. But in Events, they can't. But we provide the res object.

import { IAfterDeleteContext } from "axe-api";

export default async ({ req, res, item }: IAfterDeleteContext) => {
  if (!req.original.auth) {
    return res.status(403).json({ error: "Unauthorized" });
  }

  // some code here
};

We should have special event parameter types, and exclude res from the parameter types.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestqualitySomething about the code quality of the projectversion-minorMinor version changes

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions