Refactor network service, clear auth and monitor state on bad token
This commit is contained in:
1 parent
1255e2c13d
commit
ef4bfec3f2
3 files changed
+38
-8
No files matched your search
@@ -0,0 +1,15 @@
|
||||
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 }) => {
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const networkService = new NetworkService(store, dispatch, navigate);
|
||||
setNetworkService(networkService);
|
||||
return children;
|
||||
};
|
||||
|
||||
export default NetworkServiceProvider;
|
||||
Reference in new issue
Block a user