change || to ??

This commit is contained in:
2026-04-11 19:15:01 +07:00
parent ac40097bdd
commit fab72e86a6
12 changed files with 23 additions and 28 deletions

View File

@@ -445,7 +445,7 @@ exports.api = async (req, res) => {
// Add base URL to images
const baseUrl =
process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
process.env.BACKEND_URL ?? `${req.protocol}://${req.get("host")}`;
const processedBlogs = blogs.map((blog) =>
addBaseUrlToImages(blog, baseUrl),
);
@@ -515,7 +515,7 @@ exports.apiShow = async (req, res) => {
// Add base URL to images
const baseUrl =
process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
process.env.BACKEND_URL ?? `${req.protocol}://${req.get("host")}`;
const processedBlog = addBaseUrlToImages(blog, baseUrl);
res.json({
@@ -662,7 +662,7 @@ exports.apiRecent = async (req, res) => {
// Add base URL to images
const baseUrl =
process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
process.env.BACKEND_URL ?? `${req.protocol}://${req.get("host")}`;
const processedPosts = recentPosts.map((post) =>
addBaseUrlToImages(post, baseUrl),
);