fix: handle empty values in slug+id generation

This commit is contained in:
WDI-Ideas
2026-03-30 02:42:41 +05:30
parent 620ddcaa8e
commit 9ec5604e5e

View File

@@ -18,7 +18,8 @@ export const createSlug = (text: string): string => {
* Example: "Ad ut neque enim omn", "e7d611b6-853b-4785-b508-599eeed2af92" -> "ad-ut-neque-enim-omn-e7d611b6-853b-4785-b508-599eeed2af92"
*/
export const getSlugWithId = (title: string, id: string) => {
return `${createSlug(title)}-${id}`;
const slug = createSlug(title);
return slug && id ? `${slug}-${id}` : slug || id;
};
/**