Skip to content

chore: fix auth routes#22

Merged
eugbyte merged 4 commits intomainfrom
chore/fix-auth-routes
Aug 30, 2025
Merged

chore: fix auth routes#22
eugbyte merged 4 commits intomainfrom
chore/fix-auth-routes

Conversation

@eugbyte
Copy link
Owner

@eugbyte eugbyte commented Aug 30, 2025

No description provided.

@eugbyte eugbyte requested a review from Copilot August 30, 2025 05:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the authentication routing structure in a React application using TanStack Router. The main purpose is to reorganize authenticated routes from using path-based grouping (auth) to layout-based grouping, centralizing auth logic and improving route organization.

Key changes:

  • Replaces the old (auth) route structure with a new guardRoute function for authentication
  • Moves authenticated routes from routes/(auth)/ to routes/gatherings/(auth) and routes/bookings/(auth)/
  • Creates new auth layout components that use the centralized guardRoute function

Reviewed Changes

Copilot reviewed 12 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/evently.client/src/routes/gatherings/(auth).route.tsx New auth layout component for gatherings with route guard
src/evently.client/src/routes/gatherings/(auth).create.tsx Updated route path and import references
src/evently.client/src/routes/gatherings/$gatheringId/(auth).update.tsx Updated route path and import references
src/evently.client/src/routes/bookings/(auth)/route.tsx New auth layout component for bookings with route guard
src/evently.client/src/routes/bookings/(auth)/hosting/index.tsx Updated route path
src/evently.client/src/routes/bookings/(auth)/hosting/$gatheringId/dashboard.scan.tsx Updated route path
src/evently.client/src/routes/bookings/(auth)/hosting/$gatheringId/dashboard.index.tsx Updated route path
src/evently.client/src/routes/bookings/(auth)/attending/index.tsx Updated route path
src/evently.client/src/routes/_auth.tsx Updated route configuration
src/evently.client/src/routes/(auth)/gatherings/route.tsx Removed old auth route file
src/evently.client/src/routeTree.gen.ts Auto-generated route tree updates
src/evently.client/src/lib/services/auth-service.ts Added new guardRoute function

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 34 to 44
export async function guardRoute(account: Account | null): Promise<void> {
if (account == null) {
throw redirect({
to: "/login",
replace: true,
search: {
redirect: location.href
}
});
}
}
Copy link

Copilot AI Aug 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The location.href usage will fail in server-side rendering contexts. Consider using the route context or a safer alternative to get the current URL.

Copilot uses AI. Check for mistakes.
Comment on lines 10 to 14
return (
<>
<Outlet />
</>
);
Copy link

Copilot AI Aug 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The React Fragment wrapper is unnecessary here. You can return <Outlet /> directly.

Suggested change
return (
<>
<Outlet />
</>
);
return <Outlet />;

Copilot uses AI. Check for mistakes.
Comment on lines 10 to 14
return (
<>
<Outlet />
</>
);
Copy link

Copilot AI Aug 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The React Fragment wrapper is unnecessary here. You can return <Outlet /> directly.

Suggested change
return (
<>
<Outlet />
</>
);
return <Outlet />;

Copilot uses AI. Check for mistakes.
@eugbyte eugbyte merged commit 3155e3c into main Aug 30, 2025
1 check passed
@eugbyte eugbyte deleted the chore/fix-auth-routes branch August 30, 2025 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants