f84c21f829
This commit introduces a new `clearable` prop to the `Select` component, allowing users to easily reset its value. When the `clearable` prop is set to true, a clear button (an 'X' icon) is displayed when an option is selected. Clicking this button resets the select input to its initial placeholder state and triggers an optional `onClear` callback. To support this, the component's internal state management was refactored to control the input's value. Additionally, the `AdminListFilters` component has been updated to: - Utilize the new clearable select for the status filter. - Consolidate multiple search fields (email, username, full_name) into a single generic "search" input. - Add explicit "Reset" and "Apply" buttons for better filter management.
11 lines
386 B
TypeScript
11 lines
386 B
TypeScript
import { API_ENDPOINTS, userService } from "@/lib/api";
|
|
import { useQuery } from "@tanstack/react-query";
|
|
import { useMemo } from "react";
|
|
|
|
export const useGetAdminListQuery = (params?: Record<string, any>) => {
|
|
const queryKey = useMemo(() => [API_ENDPOINTS.USER.ADMINS, params], [params]);
|
|
return useQuery({
|
|
queryKey,
|
|
queryFn: () => userService.adminsList(params),
|
|
});
|
|
}; |