import useSWR from '../../../../../node_modules/swr/core/dist/index.mjs';
import { useSelf } from './useSelf.mjs';
import { useStytchClient } from './useStytchClient.mjs';

const useRbac = (resourceId, action)=>{
    const client = useStytchClient();
    const { self } = useSelf();
    const memberId = self?.member_id;
    return useSWR(()=>memberId && [
            'rbac',
            memberId,
            resourceId,
            action
        ], ()=>client.rbac.isAuthorized(resourceId, action), {
        keepPreviousData: true
    });
};

export { useRbac };
//# sourceMappingURL=useRbac.mjs.map
