change AdminShow and AuthShow logic
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { useSession } from '@/lib/auth-client';
|
||||
import { useAuth } from './auth-provider';
|
||||
|
||||
const AdminShow = ({ children }: { children: React.ReactNode }) => {
|
||||
const { data } = useSession();
|
||||
const isAdmin = data?.user?.role ? data?.user?.role === 'admin' : false;
|
||||
const { isAdmin } = useAuth();
|
||||
|
||||
return isAdmin && children;
|
||||
};
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { useSession } from '@/lib/auth-client';
|
||||
import { useAuth } from './auth-provider';
|
||||
|
||||
const AuthShow = ({ children }: { children: React.ReactNode }) => {
|
||||
const { data } = useSession();
|
||||
const isAuth = !!data;
|
||||
const { isAuth } = useAuth();
|
||||
|
||||
return isAuth && children;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user