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 AdminShow = ({ children }: { children: React.ReactNode }) => {
|
||||||
const { data } = useSession();
|
const { isAdmin } = useAuth();
|
||||||
const isAdmin = data?.user?.role ? data?.user?.role === 'admin' : false;
|
|
||||||
|
|
||||||
return isAdmin && children;
|
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 AuthShow = ({ children }: { children: React.ReactNode }) => {
|
||||||
const { data } = useSession();
|
const { isAuth } = useAuth();
|
||||||
const isAuth = !!data;
|
|
||||||
|
|
||||||
return isAuth && children;
|
return isAuth && children;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,5 +7,11 @@ export const Route = createFileRoute('/(app)/(auth)/account/settings')({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function RouteComponent() {
|
function RouteComponent() {
|
||||||
return <div>Hello "account/settings"!</div>;
|
return (
|
||||||
|
<div className="@container/main flex flex-1 flex-col gap-2 p-4">
|
||||||
|
<div className="*:data-[slot=card]:from-primary/5 *:data-[slot=card]:to-card dark:*:data-[slot=card]:bg-card *:data-[slot=card]:bg-linear-to-br *:data-[slot=card]:shadow-xs grid grid-cols-1 @xl/main:grid-cols-2 @5xl/main:grid-cols-3 gap-4">
|
||||||
|
abc
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user