Optional
params: SubmissionParamsOptional additional parameters to filter or paginate the submissions:
projectId
: The ID of the project to which the submissions belong.schemaId
: The ID of the schema used for filtering submissions.state
: The state(s) of the submissions to filter by. Can be a single state or an array of
states.ownerId
: The ID of the owner to filter submissions by.limit
: The maximum number of submissions to fetch in a single query. Useful for
pagination.page
: The page number to fetch when paginating through submissions. Typically used
alongside limit
.The returning object contains:
submissions
: The list of submissions that are in the "submitted" state.approveAll
: Function to approve all submissions in the current list.refresh
: Function to refresh the list of submissions by re-fetching them from the
backend. Pass quiet
to suppress loading indicators.rejectAll
: Function to reject all submissions in the current list.fetchMore
: Function to fetch additional submissions beyond the current list.
Pass refresh
to indicate whether to refresh the existing list.fetched
: Boolean indicating whether the list of submissions has been fetched from the
backend.hasMore
: Boolean indicating whether there are more submissions available to fetch.currentPage
: The current page of submissions that has been fetched."submitted"
state,
which is pre-set in the params
passed to the useSubmissions
hook.params
) are forwarded to the
useSubmissions
hook, allowing further filtering, pagination, or customization of the
submission query.useSubmissions
: This hook delegates data fetching and state
management to the useSubmissions
hook, with the added benefit of only fetching submissions
that have been "submitted".useSubmissions
hook, allowing
you to fetch more submissions if necessary, and handle the results accordingly.useSubmissions
hook are passed through,
and they should be handled as needed.import { useValidatedSubmissions } from 'react-playmakers';
const ValidatedSubmissionsList = () => {
const { submissions, fetchMore, refresh, fetched } = useValidatedSubmissions({ limit: 10 });
if (!fetched) {
return <div>Loading submissions...</div>;
}
return (
<div>
{submissions.map(submission => (
<div key={submission.id}>{submission.name}</div>
))}
<button onClick={() => fetchMore()}>Load More</button>
<button onClick={() => refresh(false)}>Refresh</button>
</div>
);
};
Generated using TypeDoc
Custom React hook to fetch and manage submissions that are in the "submitted" state.
This hook is a specialized wrapper around the useSubmissions hook, allowing you to fetch submissions that are marked as "submitted" and optionally pass additional parameters for filtering or pagination.