mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +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
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);
|
||||
|
|
9
src/utils/dom/hideLoader.ts
Normal file
9
src/utils/dom/hideLoader.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
export const hideLoader = () => {
|
||||
const loader = document.getElementById('main_loader');
|
||||
|
||||
if (!loader) {
|
||||
return;
|
||||
}
|
||||
|
||||
loader.style.display = 'none';
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue