Commit f0ef6479 authored by konstantin-smirnov's avatar konstantin-smirnov

DMVP-1081 - Настроить поиск в списке всех профилей в административной панели на странице Profiles

parent 55f099fa
......@@ -68,9 +68,15 @@ export const practitionersApi = createApi({
providesTags: (result) => ["Practitioner"],
}),
fetchPractitioners: build.query({
query: (page = 0) => ({
url: ADMIN_URI + PROFILES_LIST + "?page=" + page
}),
query: ({ page = 0, search = ''}) => {
let tail = '?page=' + page;
if (search) {
tail = "?search=" + search + '&page=' + page;
}
return {
url: ADMIN_URI + PROFILES_LIST + tail,
}
},
providesTags: (result) => ["Practitioners"],
}),
fetchOnePractitioner: build.query({
......
......@@ -34,7 +34,8 @@ const Practitioners = () => {
// useGetPostsQuery();
const navigate = useNavigate();
const [page, setPage] = useState(0);
const { isLoading, isError, data = {}} = useFetchPractitionersQuery(page);
const [search, setSearch] = useState('');
const { isLoading, isError, data = {}} = useFetchPractitionersQuery({ page, search });
const { content: practitioners = [], totalElements} = data;
const [
deletePractitioner,
......@@ -51,6 +52,7 @@ const Practitioners = () => {
const [scheduleCreationError, setIsScheduleCreationError] = useState('');
const [skip, setSkip] = useState(true);
const [id, setId] = useState();
const { isLoading: isFetchingOnePractitioner, data: practitioner = {}} = useFetchOnePractitionerQuery(id, {
skip
});
......@@ -164,24 +166,12 @@ const Practitioners = () => {
h='50px'
placeholder=" "
id="outlined-controlled"
//value={name}
value={search}
onChange={(event) => {
// setFullName(event.target.value);
setSearch(event.target.value);
}}
/>
</div>
<div>
<Button
w='180px'
h='50px'
variant='outline'
colorScheme='teal'
size='xl'
// onClick={onClose}
>
Search
</Button>
</div>
</div>
{
isLoading ? (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment