Fix: Radar auth check and data loading
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled

This commit is contained in:
2025-12-13 13:48:15 +01:00
parent 21b06449ec
commit 4568679f01

View File

@ -66,7 +66,7 @@ interface SearchResult {
// ============================================================================
export default function RadarPage() {
const { isAuthenticated, domains, addDomain, user, subscription, logout } = useStore()
const { isAuthenticated, isLoading: authLoading, domains, addDomain, user, subscription, logout, checkAuth } = useStore()
const { toast, showToast, hideToast } = useToast()
const [hotAuctions, setHotAuctions] = useState<HotAuction[]>([])
@ -81,6 +81,11 @@ export default function RadarPage() {
// Mobile Menu State
const [menuOpen, setMenuOpen] = useState(false)
// Check auth on mount
useEffect(() => {
checkAuth()
}, [checkAuth])
// Load Data
const loadDashboardData = useCallback(async () => {
@ -99,9 +104,15 @@ export default function RadarPage() {
}, [])
useEffect(() => {
if (isAuthenticated) loadDashboardData()
else setLoadingData(false)
}, [isAuthenticated, loadDashboardData])
// Wait for auth check to complete, then load data
if (!authLoading) {
if (isAuthenticated) {
loadDashboardData()
} else {
setLoadingData(false)
}
}
}, [authLoading, isAuthenticated, loadDashboardData])
// Search
const handleSearch = useCallback(async (domainInput: string) => {