fix: handle empty values in slug+id generation
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user