added the pageload api

This commit was merged in pull request #546.
This commit is contained in:
2024-01-10 17:41:52 +01:00
parent 9dde87277c
commit 57be599bb5
5 changed files with 91 additions and 1 deletions
+35
View File
@@ -0,0 +1,35 @@
import { useEffect, useState } from "react";
import usersService from "../../services/UsersService";
import { useSelector } from "react-redux";
const GetMyPageLoad = () => {
const { yourPageTable } = useSelector((state) => state.tableReload);
const [response, setResponse] = useState({
loading: true,
data: null,
error: null,
});
useEffect(() => {
const fetchData = async () => {
let api = new usersService();
try {
const res = await api.MyPageLoad();
setResponse({ loading: false, data: res.data, error: null });
console.log(response.data)
} catch (error) {
setResponse({ loading: false, data: null, error: error.message });
}
};
fetchData();
}, [yourPageTable]);
return response;
};
export default GetMyPageLoad;