rename folder structure

This commit is contained in:
2024-10-26 11:21:04 +03:30
parent 8636dd214d
commit 64541d52c0
15 changed files with 78 additions and 80 deletions

View File

@@ -0,0 +1,30 @@
import {useEffect, useState} from "react";
import {GET_AZMAYESH_TYPE_LIST} from "@/core/utils/routes";
import useRequest from "@/lib/hooks/useRequest";
const useAzmayesh = () => {
const requestServer = useRequest();
const [azmayeshes, setAzmayeshes] = useState([]);
const [loadingAzmayeshes, setLoadingAzmayeshes] = useState(true);
const [errorAzmayeshes, setErrorAzmayeshes] = useState(null);
useEffect(() => {
const fetchTests = async () => {
try {
const response = await requestServer(`${GET_AZMAYESH_TYPE_LIST}`);
setAzmayeshes(response.data.data);
setLoadingAzmayeshes(false);
} catch (e) {
console.error("Error fetching tests types:", e);
setErrorAzmayeshes(e);
setLoadingAzmayeshes(false);
}
};
fetchTests();
}, []);
return {azmayeshes, loadingAzmayeshes, errorAzmayeshes};
};
export default useAzmayesh;

View File

@@ -1,30 +0,0 @@
import {useEffect, useState} from "react";
import {GET_TESTS_LIST} from "@/core/utils/routes";
import useRequest from "@/lib/hooks/useRequest";
const useTest = () => {
const requestServer = useRequest();
const [tests, setTests] = useState([]);
const [loadingTests, setLoadingTests] = useState(true);
const [errorTests, setErrorTests] = useState(null);
useEffect(() => {
const fetchTests = async () => {
try {
const response = await requestServer(`${GET_TESTS_LIST}`);
setTests(response.data.data);
setLoadingTests(false);
} catch (e) {
console.error("Error fetching tests types:", e);
setErrorTests(e);
setLoadingTests(false);
}
};
fetchTests();
}, []);
return {tests, loadingTests, errorTests};
};
export default useTest;