Files
web/apps/scandic-web/utils/appendSlugToPathname.ts
2025-05-16 06:21:09 +00:00

15 lines
305 B
TypeScript

import { headers } from "next/headers"
import { getLang } from "@/i18n/serverContext"
export function appendSlugToPathname(slug?: string) {
const pathname = headers().get("x-pathname")
const lang = getLang()
if (!pathname || !slug) {
return null
}
return `/${lang}${pathname}/${slug}`
}