mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-05-24 11:59:39 -05:00
Merge pull request #1641 from YinDongFang/fix/networkservice
Fix redundant instantiation of NetworkService
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useNavigate } from "react-router";
|
||||
import { setNetworkService } from "./NetworkService";
|
||||
import NetworkService from "./NetworkService";
|
||||
import NetworkService, { networkService } from "./NetworkService";
|
||||
import { store } from "../store";
|
||||
|
||||
const NetworkServiceProvider = ({ children }) => {
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const networkService = new NetworkService(store, dispatch, navigate);
|
||||
setNetworkService(networkService);
|
||||
if (!networkService) {
|
||||
setNetworkService(new NetworkService(store, dispatch, navigate));
|
||||
}
|
||||
return children;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user