Skip to content

Commit

Permalink
🐛 Fix redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
PHPLukaas committed May 17, 2024
1 parent b960fd7 commit c0cbec1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions frontend-react/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
"use client";
import { useEffect } from 'react';
import { verifySession } from '@/app/lib/dal';
import {redirect} from "next/navigation";
import { useRouter } from "next/navigation";

export default function HomePage() {
const router = useRouter();

useEffect(() => {
const checkSession = async () => {
const session = await verifySession();
if (!session) {
console.log('No session');
} else {
redirect('/users')
router.push('/users')
}
};
checkSession().then(r => r);
}, []);
});

return <div>Loading...</div>;
}

0 comments on commit c0cbec1

Please sign in to comment.