added the pageload api
This commit was merged in pull request #546.
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user