Skip to content

Commit a5cd0ed

Browse files
committed
refactor: replace hardcoded dashboard and settings URLs with route helper
1 parent e329ad2 commit a5cd0ed

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

resources/js/components/app-header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import AppLogoIcon from './app-logo-icon';
1818
const mainNavItems: NavItem[] = [
1919
{
2020
title: 'Dashboard',
21-
url: '/dashboard',
21+
url: route('dashboard'),
2222
icon: LayoutGrid,
2323
},
2424
];
@@ -94,7 +94,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
9494
</Sheet>
9595
</div>
9696

97-
<Link href="/dashboard" prefetch className="flex items-center space-x-2">
97+
<Link href={route('dashboard')} prefetch className="flex items-center space-x-2">
9898
<AppLogo />
9999
</Link>
100100

resources/js/components/app-sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import AppLogo from './app-logo';
1010
const mainNavItems: NavItem[] = [
1111
{
1212
title: 'Dashboard',
13-
url: '/dashboard',
13+
url: route('dashboard'),
1414
icon: LayoutGrid,
1515
},
1616
];
@@ -35,7 +35,7 @@ export function AppSidebar() {
3535
<SidebarMenu>
3636
<SidebarMenuItem>
3737
<SidebarMenuButton size="lg" asChild>
38-
<Link href="/dashboard" prefetch>
38+
<Link href={route('dashboard')} prefetch>
3939
<AppLogo />
4040
</Link>
4141
</SidebarMenuButton>

resources/js/layouts/settings/layout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ import { Link } from '@inertiajs/react';
88
const sidebarNavItems: NavItem[] = [
99
{
1010
title: 'Profile',
11-
url: '/settings/profile',
11+
url: route('profile.edit'),
1212
icon: null,
1313
},
1414
{
1515
title: 'Password',
16-
url: '/settings/password',
16+
url: route('password.edit'),
1717
icon: null,
1818
},
1919
{
2020
title: 'Appearance',
21-
url: '/settings/appearance',
21+
url: route('appearance'),
2222
icon: null,
2323
},
2424
];

resources/js/pages/dashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Head } from '@inertiajs/react';
66
const breadcrumbs: BreadcrumbItem[] = [
77
{
88
title: 'Dashboard',
9-
href: '/dashboard',
9+
href: route('dashboard'),
1010
},
1111
];
1212

tests/Feature/DashboardTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ class DashboardTest extends TestCase
1212

1313
public function test_guests_are_redirected_to_the_login_page()
1414
{
15-
$this->get('/dashboard')->assertRedirect('/login');
15+
$this->get(route('dashboard'))->assertRedirect('/login');
1616
}
1717

1818
public function test_authenticated_users_can_visit_the_dashboard()
1919
{
2020
$this->actingAs($user = User::factory()->create());
2121

22-
$this->get('/dashboard')->assertOk();
22+
$this->get(route('dashboard'))->assertOk();
2323
}
2424
}

0 commit comments

Comments
 (0)