mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 03:56:16 +00:00
fix(plugin-file-manager): fix calling rule hook on read-pretty fields (#5447)
This commit is contained in:
parent
9f6b162782
commit
c8741e7656
@ -7,16 +7,25 @@
|
|||||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { useCollectionField, useCollectionManager, useRequest } from '@nocobase/client';
|
import { useField } from '@formily/react';
|
||||||
|
import { useAPIClient, useCollectionField, useCollectionManager, useRequest } from '@nocobase/client';
|
||||||
|
|
||||||
export function useStorageRules(storage) {
|
export function useStorageRules(storage) {
|
||||||
const name = storage ?? '';
|
const name = storage ?? '';
|
||||||
|
const apiClient = useAPIClient();
|
||||||
|
const field = useField<any>();
|
||||||
const { loading, data } = useRequest<any>(
|
const { loading, data } = useRequest<any>(
|
||||||
{
|
async () => {
|
||||||
url: `storages:getRules/${name}`,
|
if (field.pattern !== 'editable') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return apiClient.request({
|
||||||
|
url: `storages:getRules/${name}`,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
refreshDeps: [name],
|
refreshDeps: [name],
|
||||||
|
cacheKey: name,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
return (!loading && data?.data) || null;
|
return (!loading && data?.data) || null;
|
||||||
|
Loading…
Reference in New Issue
Block a user