mirror of
https://github.com/AeThex-Corporation/AeThex-OS.git
synced 2026-04-20 15:17:19 +00:00
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:
parent
724d621e59
commit
9c99d35836
9 changed files with 54 additions and 27 deletions
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Reference in a new issue