fix: Move generateSlug to admin page to prevent client-side bundling of server utils
This commit is contained in:
@@ -46,19 +46,3 @@ export async function verifyJWT(token: string): Promise<{ userId: number; userna
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export function generateSlug(title: string, date: string): string {
|
||||
const formattedTitle = title
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9\s-]/g, '')
|
||||
.replace(/\s+/g, '-')
|
||||
.replace(/-+/g, '-')
|
||||
.trim()
|
||||
|
||||
const dateObj = new Date(date)
|
||||
const month = String(dateObj.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(dateObj.getDate()).padStart(2, '0')
|
||||
const year = dateObj.getFullYear()
|
||||
|
||||
return `sermon-${month}${day}${year}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user