Improve admin page navigation by delaying redirects

Fixes issues where admin pages would incorrectly redirect to login by adding a short delay to authentication checks.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 279f1558-c0e3-40e4-8217-be7e9f4c6eca
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 0cf85aaf-4648-41fb-9f64-9582eea59cc1
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/b984cb14-1d19-4944-922b-bc79e821ed35/279f1558-c0e3-40e4-8217-be7e9f4c6eca/bYlft3B
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
sirpiglr 2025-12-16 00:40:38 +00:00
parent 724d621e59
commit 9c99d35836
9 changed files with 54 additions and 27 deletions

View file

@ -13,9 +13,12 @@ export default function AdminAchievements() {
const [, setLocation] = useLocation();
useEffect(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
const timer = setTimeout(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
}, 200);
return () => clearTimeout(timer);
}, [authLoading, isAuthenticated, setLocation]);
const { data: achievements, isLoading } = useQuery({

View file

@ -13,9 +13,12 @@ export default function AdminAegis() {
const queryClient = useQueryClient();
useEffect(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
const timer = setTimeout(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
}, 200);
return () => clearTimeout(timer);
}, [authLoading, isAuthenticated, setLocation]);
const { data: alerts } = useQuery({

View file

@ -16,9 +16,12 @@ export default function AdminApplications() {
const queryClient = useQueryClient();
useEffect(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
const timer = setTimeout(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
}, 200);
return () => clearTimeout(timer);
}, [authLoading, isAuthenticated, setLocation]);
const { data: applications, isLoading } = useQuery({

View file

@ -17,9 +17,12 @@ export default function AdminArchitects() {
const queryClient = useQueryClient();
useEffect(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
const timer = setTimeout(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
}, 200);
return () => clearTimeout(timer);
}, [authLoading, isAuthenticated, setLocation]);
const { data: profiles, isLoading } = useQuery({

View file

@ -11,9 +11,12 @@ export default function AdminCredentials() {
const [, setLocation] = useLocation();
useEffect(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
const timer = setTimeout(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
}, 200);
return () => clearTimeout(timer);
}, [authLoading, isAuthenticated, setLocation]);
if (authLoading || !isAuthenticated) {

View file

@ -13,9 +13,12 @@ export default function AdminLogs() {
const [, setLocation] = useLocation();
useEffect(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
const timer = setTimeout(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
}, 200);
return () => clearTimeout(timer);
}, [authLoading, isAuthenticated, setLocation]);
const { data: logs, isLoading } = useQuery({

View file

@ -45,9 +45,12 @@ export default function AdminNotifications() {
const [saved, setSaved] = useState(false);
useEffect(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
const timer = setTimeout(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
}, 200);
return () => clearTimeout(timer);
}, [authLoading, isAuthenticated, setLocation]);
const toggleSetting = (id: string) => {

View file

@ -13,9 +13,12 @@ export default function AdminProjects() {
const [, setLocation] = useLocation();
useEffect(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
const timer = setTimeout(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
}, 200);
return () => clearTimeout(timer);
}, [authLoading, isAuthenticated, setLocation]);
const { data: projects, isLoading } = useQuery({

View file

@ -13,9 +13,12 @@ export default function AdminSites() {
const [, setLocation] = useLocation();
useEffect(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
const timer = setTimeout(() => {
if (!authLoading && !isAuthenticated) {
setLocation("/login");
}
}, 200);
return () => clearTimeout(timer);
}, [authLoading, isAuthenticated, setLocation]);
const { data: sites, isLoading } = useQuery({