Auth and session middleware.
This commit is contained in:
12
pages/api/website.js
Normal file
12
pages/api/website.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import { getWebsites } from 'lib/db';
|
||||
import { useAuth } from 'lib/middleware';
|
||||
|
||||
export default async (req, res) => {
|
||||
await useAuth(req, res);
|
||||
|
||||
const { user_id } = req.auth;
|
||||
|
||||
const websites = await getWebsites(user_id);
|
||||
|
||||
res.status(200).json({ websites });
|
||||
};
|
||||
Reference in New Issue
Block a user