mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-31 22:28:36 -06:00
Fix redundant instantiation of NetworkService
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
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) {
|
||||
const networkService = new NetworkService(store, dispatch, navigate);
|
||||
setNetworkService(networkService);
|
||||
}
|
||||
return children;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user