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.
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
resobject.We should have special event parameter types, and exclude
resfrom the parameter types.