import prisma from '../../lib/prisma';

const deletePost = async (req, res) => {
  const { slug } = req.headers;
  await prisma.post.delete({
    where: {
      slug,
    },
  });

  res.writeHead(200, { Location: '/dashboard/posts' });
  res.end();
};

export default deletePost;
