Redux toolkit (#115)
* add @redux/toolkit * bump react version to allow for hooks * add remote-redux devtools to help track extension state * add remote-redux server to allow for remote state viewing * setup react-redux for current user * setup watch mode for running redux remote dev watch to options * move screenshots
This commit is contained in:
16
src/utils/checkCurrentUser.ts
Normal file
16
src/utils/checkCurrentUser.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { RootStore } from '../stores/createStore';
|
||||
import { fetchCurrentUser } from '../reducers/currentUser';
|
||||
|
||||
type unsub = () => void;
|
||||
export default (store: RootStore) => (time: number): unsub => {
|
||||
const fetchUser = () => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
store.dispatch(fetchCurrentUser());
|
||||
};
|
||||
fetchUser();
|
||||
const timeout = setInterval(fetchUser, time);
|
||||
return () => {
|
||||
clearInterval(timeout);
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user