Handle website delete. Added response helper functions.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { useAuth } from 'lib/middleware';
|
||||
import { ok, unauthorized } from 'lib/response';
|
||||
|
||||
export default async (req, res) => {
|
||||
await useAuth(req, res);
|
||||
|
||||
if (req.auth) {
|
||||
return res.status(200).json(req.auth);
|
||||
return ok(res, req.auth);
|
||||
}
|
||||
|
||||
return res.status(401).end();
|
||||
return unauthorized(res);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user