Fixed infinite loop on the dashboards

This commit is contained in:
Joao Ramos
2024-09-06 23:48:18 +01:00
parent f6550e6a36
commit 58448a391f
13 changed files with 102 additions and 49 deletions

View File

@@ -2,10 +2,13 @@ import {Type, User} from "@/interfaces/user";
import Axios from "axios";
import {useEffect, useState} from "react";
import {setupCache} from "axios-cache-interceptor";
const instance = Axios.create();
const axios = setupCache(instance);
export const userHashStudent = { type: "student" } as { type: Type };
export const userHashTeacher = { type: "teacher" } as { type: Type };
export const userHashCorporate = { type: "corporate" } as { type: Type };
export default function useUsers(props?: {type?: Type; page?: number; size?: number}) {
const [users, setUsers] = useState<User[]>([]);
const [total, setTotal] = useState(0);