Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ services:
args:
- VITE_API_URL=http://localhost:8000
- NODE_ENV=development
depends_on:
backend:
condition: service_healthy

playwright:
build:
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/routes/_layout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import { Box, Container, Text } from "@chakra-ui/react"
import { createFileRoute } from "@tanstack/react-router"
import { createFileRoute, redirect } from "@tanstack/react-router"

import useAuth from "@/hooks/useAuth"
import useAuth, { isLoggedIn } from "@/hooks/useAuth"

export const Route = createFileRoute("/_layout/")({
component: Dashboard,
beforeLoad: async () => {
Copy link
Member

Choose a reason for hiding this comment

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

the parent layout's guard (_layout.tsx) executes before any child route's guard so this one here seems unnecessary 🤔

Copy link
Author

Choose a reason for hiding this comment

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

oh, just check, you are right👌🏾

if (!isLoggedIn()) {
throw redirect({
to: "/login",
})
}
},
})

function Dashboard() {
Expand Down
Loading