harim manager

This commit is contained in:
2025-11-26 15:06:53 +03:30
parent 6e5ef8d10b
commit efe47523a2
20 changed files with 473 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import { useState, useEffect } from "react";
import useRequest from "@/lib/hooks/useRequest";
import { GET_HISTORY_LIST } from "@/core/utils/routes";
export const useHistory = (rowId) => {
const requestServer = useRequest();
const [historyData, setHistoryData] = useState([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
useEffect(() => {
if (!rowId) return;
const fetchHistory = async () => {
try {
setLoading(true);
const response = await requestServer(`${GET_HISTORY_LIST}/${rowId}`);
setHistoryData(response.data.data);
} catch (err) {
setError(err.message);
} finally {
setLoading(false);
}
};
fetchHistory();
}, [rowId]);
return { historyData, loading, error };
};