Skip to content

Commit 5db8400

Browse files
committed
refactor: ensure numeric response types and update .gitignore
1 parent d9e3ebe commit 5db8400

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ yarn-error.log*
2828

2929
# local env files
3030
.env*.local
31+
.env
3132

3233
# vercel
3334
.vercel

pages/api/views/[slug].ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default async function handler(
2323
});
2424

2525
return res.status(200).json({
26-
total: views.count,
26+
total: Number(views.count),
2727
});
2828
}
2929

@@ -34,7 +34,7 @@ export default async function handler(
3434
},
3535
});
3636

37-
return res.status(200).json({ total: views?.count });
37+
return res.status(200).json({ total: Number(views?.count ?? 0) });
3838
}
3939
} catch {
4040
return res.status(500).json({

pages/api/views/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default async function handler(
1515
},
1616
});
1717

18-
return res.status(200).json({ total: count });
18+
return res.status(200).json({ total: Number(count ?? 0) });
1919
} catch {
2020
return res.status(500).json({
2121
error: {

0 commit comments

Comments
 (0)