node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
import * as React from 'react';
import { useNotification, useFetchClient } from '@strapi/admin/strapi-admin';
import { useNotifyAT } from '@strapi/design-system';
import { stringify } from 'qs';
import { useIntl } from 'react-intl';
import { useQuery } from 'react-query';
import { pluginId } from '../pluginId.mjs';
const useFolders = ({ enabled = true, query = {} } = {})=>{
const { formatMessage } = useIntl();
const { toggleNotification } = useNotification();
const { notifyStatus } = useNotifyAT();
const { folder, _q, ...paramsExceptFolderAndQ } = query;
const { get } = useFetchClient();
let params;
if (_q) {
params = {
...paramsExceptFolderAndQ,
pagination: {
pageSize: -1
},
_q
};
} else {
params = {
...paramsExceptFolderAndQ,
pagination: {
pageSize: -1
},
filters: {
$and: [
...paramsExceptFolderAndQ?.filters?.$and ?? [],
{
parent: {
id: folder ?? {
$null: true
}
}
}
]
}
};
}
const { data, error, isLoading } = useQuery([
pluginId,
'folders',
stringify(params)
], async ()=>{
const { data: { data } } = await get('/upload/folders', {
params
});
return data;
}, {
enabled,
staleTime: 0,
cacheTime: 0,
onError () {
toggleNotification({
type: 'danger',
message: formatMessage({
id: 'notification.error'
})
});
}
});
React.useEffect(()=>{
if (data) {
notifyStatus(formatMessage({
id: 'list.asset.at.finished',
defaultMessage: 'The folders have finished loading.'
}));
}
}, [
data,
formatMessage,
notifyStatus
]);
return {
data,
error,
isLoading
};
};
export { useFolders };
//# sourceMappingURL=useFolders.mjs.map