mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
Enhancement: Expose getFeature() method for useLicenseLimits hooks
This commit is contained in:
parent
85f4c892e0
commit
f4720e22db
@ -1,3 +1,5 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { useFetchClient, useRBAC } from '@strapi/helper-plugin';
|
||||
import { useQuery } from 'react-query';
|
||||
import { useSelector } from 'react-redux';
|
||||
@ -27,5 +29,16 @@ export function useLicenseLimits() {
|
||||
}
|
||||
);
|
||||
|
||||
return { license: data ?? {}, isError, isLoading };
|
||||
const license = data ?? {};
|
||||
|
||||
const getFeature = React.useCallback(
|
||||
(name) => {
|
||||
const feature = (license?.features ?? []).find((feature) => feature.name === name);
|
||||
|
||||
return feature?.options ?? {};
|
||||
},
|
||||
[license?.features]
|
||||
);
|
||||
|
||||
return { license, getFeature, isError, isLoading };
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user