Skip to content

Commit

Permalink
Refactor/UI (#132)
Browse files Browse the repository at this point in the history
Refactor/UI
  • Loading branch information
phatna03 authored Mar 19, 2024
1 parent 0ad0560 commit cedf1a6
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions packages/admin/src/hocs/RouterGuard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useCallback } from 'react';
import { useAccount } from '@casperdash/usewallet';
import { AdminPaths, PublicPaths } from '@mlem-admin/enums/paths.enum';
import { checkUser, setUserInfo } from '@mlem-admin/services/auth';
import { isAdmin } from '@mlem-admin/utils/permission';
// import { isAdmin } from '@mlem-admin/utils/permission';
import { useRouter } from 'next/router';

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down Expand Up @@ -43,33 +43,26 @@ const RouterGuard = ({ children }: { children: any }) => {

setUserInfo(JSON.stringify(user));

//custome
//temporary open for tester
return;

if (isAdmin(user)) {
return;
}
// if (isAdmin(user)) {
// return;
// }

const path = url.split('?')[0];
if (!adminPaths.includes(path as string)) {
return;
}

router.push({
pathname: PublicPaths.HOME,
});
// router.push({
// pathname: PublicPaths.HOME,
// });
} catch (error) {

//custome
//temporary open for tester
return;

router.push({
pathname: PublicPaths.HOME,
});
// router.push({
// pathname: PublicPaths.HOME,
// });
}

return;

// eslint-disable-next-line react-hooks/exhaustive-deps
},
[router]
Expand Down

0 comments on commit cedf1a6

Please sign in to comment.