Skip to content

Commit

Permalink
login navigate to rpkm page
Browse files Browse the repository at this point in the history
  • Loading branch information
TeeGoood committed Jul 29, 2024
1 parent ec4fcd8 commit 2cac5c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/app/(main)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ function Login() {
let newPath;

if (isStaff) {
newPath = isRegistered ? '/firstdate/staff/home' : '/staff/register';
const isRpkm =
new Date(process.env.NEXT_PUBLIC_RPKM_DAY_1 as string) < new Date();

newPath = !isRegistered
? '/staff/register'
: isRpkm
? '/rpkm/staff/home'
: '/firstdate/staff/home';
} else {
newPath = isRegistered ? '/home' : '/register';
}
Expand Down
6 changes: 4 additions & 2 deletions src/app/(main)/staff/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ export default function Register() {
if (!user) return;
toast.success('ลงทะเบียนสำเร็จ');

const isStaff = user.role == 'staff';
const newPath = isStaff ? '/firstdate/staff/home' : '/register-done';
const isRpkm =
new Date(process.env.NEXT_PUBLIC_RPKM_DAY_1 as string) < new Date();

let newPath = isRpkm ? '/rpkm/staff/home' : '/firstdate/staff/home';

await resetContext();
router.push(newPath);
Expand Down

0 comments on commit 2cac5c6

Please sign in to comment.