fix type errs

This commit is contained in:
Jordi Enric
2024-02-15 23:40:27 +01:00
parent f29e043631
commit 07ec439d83
3 changed files with 9 additions and 2 deletions
@@ -10,6 +10,10 @@ export default async function handler(
const blogId = req.query.blogId as string;
if (!user?.id) {
return res.status(401).json({ error: "Unauthorized" });
}
if (req.method === "PATCH") {
const data = PatchBlog.safeParse(JSON.parse(req.body));
@@ -23,7 +27,7 @@ export default async function handler(
.from("blogs")
.update({ title, emoji, description })
.eq("id", blogId)
.eq("user_id", user?.id)
.eq("user_id", user.id)
.select()
.single();
@@ -11,6 +11,9 @@ export default async function handler(
const { db, user } = await getServerClient(req, res);
const blogId = req.query.blogId as string;
const postSlug = req.query.postSlug as string;
if (!user?.id) {
return res.status(401).json({ error: "Unauthorized" });
}
if (req.method === "PATCH") {
const data = PatchPost.safeParse(JSON.parse(req.body));
@@ -25,7 +25,7 @@ export default async function handler(
) {
const { db } = await getServerClient(req, res);
// const { userId } = getAuth(req);
const blogId = req.query.blogId;
const blogId = req.query.blogId as string;
if (!db) return res.status(401).json({ error: "Unauthorized" });