ENCOA-94: Fixes the bug, refactored useStats to be useFilterRecordsByUser in order to not duplicate code and also refactored records.tsx and training.tsx to use a component which abstracts the user Selection for both stats and training.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable @next/next/no-img-element */
|
||||
import Modal from "@/components/Modal";
|
||||
import useStats from "@/hooks/useStats";
|
||||
import useFilterRecordsByUser from "@/hooks/useFilterRecordsByUser";
|
||||
import useUsers from "@/hooks/useUsers";
|
||||
import { CorporateUser, Group, Stat, User } from "@/interfaces/user";
|
||||
import UserList from "@/pages/(admin)/Lists/UserList";
|
||||
@@ -232,7 +232,7 @@ export default function CorporateDashboard({ user }: Props) {
|
||||
const [selectedAssignment, setSelectedAssignment] = useState<Assignment>();
|
||||
const [isCreatingAssignment, setIsCreatingAssignment] = useState(false);
|
||||
|
||||
const { stats } = useStats();
|
||||
const { data: stats } = useFilterRecordsByUser<Stat[]>();
|
||||
const { users, reload, isLoading } = useUsers();
|
||||
const { codes } = useCodes(user.id);
|
||||
const { groups } = useGroups({ admin: user.id });
|
||||
|
||||
Reference in New Issue
Block a user