Feat/hide unused features

This commit is contained in:
Valentino 2022-02-09 09:03:44 +00:00
parent 8d5d0a666e
commit 41b86d4a6d
28 changed files with 3357 additions and 20314 deletions

View file

@ -1,10 +1,10 @@
import { useCallback } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { getAuth, signIn, signOut } from '../redux';
import { getAuthToken, signIn, signOut } from '../redux';
export function useAuth() {
const dispatch = useDispatch();
const auth = useSelector(getAuth);
const authToken = useSelector(getAuthToken);
const logIn = useCallback(
(params) => {
@ -18,7 +18,7 @@ export function useAuth() {
}, [dispatch]);
return {
auth,
authToken,
logIn,
logOut,
};

View file

@ -1,4 +1,4 @@
export { signIn, signOut, AuthActionTypes } from './actions';
export { default as reducer } from './reducers';
export { getAuth, getIsAuthLoading } from './selectors';
export { getAuth, getIsAuthLoading, getAuthToken } from './selectors';
export * from './types';

View file

@ -1,4 +1,4 @@
import { createApiReducer, chainReducers, INITIAL_API_STATUS, INITIAL_API_STATE } from 'src/services/api';
import { createApiReducer, chainReducers, INITIAL_API_STATUS } from 'src/services/api';
import { AuthState } from './types';
import { AuthActionTypes } from './actions';
@ -16,8 +16,8 @@ const auth = createApiReducer(
const signOut = createApiReducer(
['', AuthActionTypes.SIGN_OUT, ''],
() => INITIAL_API_STATE,
() => INITIAL_API_STATE,
() => initialState,
() => initialState,
);
export default chainReducers(initialState, auth, signOut);

View file

@ -4,6 +4,8 @@ import { isLoading } from 'src/services/api';
export const getAuth = (state: State) => state.auth;
export const getAuthToken = (state: State) => state.auth.token;
export const getIsAuthLoading = (state: State) => isLoading(getAuth(state));
export const getToken = (state: State) => state.auth.token;