2024-10-07 13:47:20 +08:00
|
|
|
import { useDispatch } from "react-redux";
|
|
|
|
|
import { useNavigate } from "react-router";
|
|
|
|
|
import { setNetworkService } from "./NetworkService";
|
|
|
|
|
import NetworkService from "./NetworkService";
|
|
|
|
|
import { store } from "../store";
|
|
|
|
|
|
|
|
|
|
const NetworkServiceProvider = ({ children }) => {
|
2024-10-17 12:05:06 +08:00
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
const networkService = new NetworkService(store, dispatch, navigate);
|
|
|
|
|
setNetworkService(networkService);
|
|
|
|
|
return children;
|
2024-10-07 13:47:20 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default NetworkServiceProvider;
|