diff --git a/src/components/HomeHeader.tsx b/src/components/HomeHeader.tsx index ba9ba45..3ee80f4 100644 --- a/src/components/HomeHeader.tsx +++ b/src/components/HomeHeader.tsx @@ -6,6 +6,8 @@ import { UserPhoto } from './UserPhoto'; import defaultAvatar from '@assets/userPhotoDefault.png'; +import { api } from '@services/api'; + import { useAuth } from '@hooks/useAuth'; export function HomeHeader() { @@ -17,7 +19,7 @@ export function HomeHeader() { return ( ( + toast.close(id)} + /> + ), + }); } } catch (error) { console.error(error); @@ -163,7 +195,13 @@ export function Profile() {
- + diff --git a/src/utils/Slug.ts b/src/utils/Slug.ts new file mode 100644 index 0000000..ab41bf3 --- /dev/null +++ b/src/utils/Slug.ts @@ -0,0 +1,10 @@ +export function slug(str: string): string { + return str + .normalize('NFD') // Normalize accented characters to decomposed form + .replace(/[\u0300-\u036f]/g, '') // Remove diacritic marks (accents) + .toLowerCase() // Convert to lowercase + .replace(/[^a-z0-9\s-]/g, '') // Remove non-alphanumeric characters except spaces and hyphens + .trim() // Remove leading and trailing spaces + .replace(/\s+/g, '-') // Replace spaces with hyphens + .replace(/-+/g, '-'); // Replace multiple hyphens with a single hyphen +}