Skip to content

Commit

Permalink
Update headless tests
Browse files Browse the repository at this point in the history
  • Loading branch information
infomiho committed Aug 27, 2024
1 parent 0e712fc commit 6ac1c85
Show file tree
Hide file tree
Showing 13 changed files with 1,131 additions and 441 deletions.
45 changes: 23 additions & 22 deletions waspc/data/Generator/templates/react-app/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,39 @@ export const routeNameToRouteComponent = {
} as const;

export function RouterRoutes() {
const routerRoutes = useRoutes([
{=# isExternalAuthEnabled =}
/*
Wasp specific routes *must* go first to prevent user
defined routes from overriding them.
Details in https://github.com/wasp-lang/wasp/issues/2029
*/
{
path: "{= oAuthCallbackPath =}",
element: <OAuthCallbackPage />
},
{=/ isExternalAuthEnabled =}
...(Object.entries(routes).map(([routeKey, route]) => {
const userDefinedRoutes = Object.entries(routes).map(([routeKey, route]) => {
const Component = routeNameToRouteComponent[routeKey]
return {
path: route.to,
element: <Component />
}
}))
})
const routerRoutes = useRoutes([
{=# isExternalAuthEnabled =}
/*
Wasp specific routes *must* go first to prevent user
defined routes from overriding them.
Details in https://github.com/wasp-lang/wasp/issues/2029
*/
{
path: "{= oAuthCallbackPath =}",
element: <OAuthCallbackPage />
},
{=/ isExternalAuthEnabled =}
...userDefinedRoutes,
])

return routerRoutes
}

export const router = (
<BrowserRouter basename="{= baseDir =}">
{=# rootComponent.isDefined =}
<{= rootComponent.importIdentifier =}>
{=/ rootComponent.isDefined =}
<RouterRoutes />
{=# rootComponent.isDefined =}
</{= rootComponent.importIdentifier =}>
{=/ rootComponent.isDefined =}
</BrowserRouter>
{=# rootComponent.isDefined =}
<{= rootComponent.importIdentifier =}>
{=/ rootComponent.isDefined =}
<RouterRoutes />
{=# rootComponent.isDefined =}
</{= rootComponent.importIdentifier =}>
{=/ rootComponent.isDefined =}
</BrowserRouter>
)

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6ac1c85

Please sign in to comment.