mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-05-04 09:06:40 +07:00
completely removed flow-related sagas
This commit is contained in:
parent
5f3accee48
commit
38eedab3c2
26 changed files with 326 additions and 310 deletions
src/utils/context
10
src/utils/context/StoreContextProvider.tsx
Normal file
10
src/utils/context/StoreContextProvider.tsx
Normal file
|
@ -0,0 +1,10 @@
|
|||
import React, { createContext, FC, useContext } from 'react';
|
||||
import { Store } from '~/store';
|
||||
|
||||
export const StoreContext = createContext<Store>(new Store());
|
||||
|
||||
export const StoreContextProvider: FC<{ store: Store }> = ({ children, store }) => {
|
||||
return <StoreContext.Provider value={store}>{children}</StoreContext.Provider>;
|
||||
};
|
||||
|
||||
export const useStore = () => useContext(StoreContext);
|
|
@ -1,11 +1,14 @@
|
|||
import React, { createContext, FC, useContext } from 'react';
|
||||
import { IUser } from '~/redux/auth/types';
|
||||
import { EMPTY_USER } from '~/redux/auth/constants';
|
||||
import { useUser } from '~/hooks/user/userUser';
|
||||
|
||||
const UserContext = createContext<IUser>(EMPTY_USER);
|
||||
|
||||
export const UserContextProvider: FC<{ user: IUser }> = ({ children, user }) => (
|
||||
<UserContext.Provider value={user}>{children}</UserContext.Provider>
|
||||
);
|
||||
export const UserContextProvider: FC = ({ children }) => {
|
||||
const user = useUser();
|
||||
|
||||
return <UserContext.Provider value={user}>{children}</UserContext.Provider>;
|
||||
};
|
||||
|
||||
export const useUserContext = () => useContext(UserContext);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue