mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
eslint
This commit is contained in:
parent
9a8e5efd1a
commit
988a069d57
4 changed files with 23 additions and 24 deletions
|
@ -1,6 +1,4 @@
|
|||
import {
|
||||
createStore, applyMiddleware, combineReducers, compose, Store
|
||||
} from 'redux';
|
||||
import { createStore, applyMiddleware, combineReducers, compose, Store } from 'redux';
|
||||
|
||||
import { persistStore, persistReducer } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
|
@ -25,7 +23,7 @@ import modalReducer, { IModalState } from '~/redux/modal/reducer';
|
|||
const authPersistConfig: PersistConfig = {
|
||||
key: 'auth',
|
||||
whitelist: ['token', 'user'],
|
||||
storage
|
||||
storage,
|
||||
};
|
||||
|
||||
export interface IState {
|
||||
|
@ -39,9 +37,10 @@ export interface IState {
|
|||
export const sagaMiddleware = createSagaMiddleware();
|
||||
export const history = createBrowserHistory();
|
||||
|
||||
const composeEnhancers = typeof window === 'object' && (<any>window).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||
? (<any>window).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({})
|
||||
: compose;
|
||||
const composeEnhancers =
|
||||
typeof window === 'object' && (<any>window).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||
? (<any>window).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({})
|
||||
: compose;
|
||||
|
||||
export const store = createStore(
|
||||
combineReducers<IState>({
|
||||
|
|
|
@ -9,35 +9,35 @@ import { IUploadState } from './reducer';
|
|||
|
||||
const addStatus = (
|
||||
state: IUploadState,
|
||||
{ temp_id, status }: ReturnType<typeof uploadAddStatus>
|
||||
{ temp_id, status, }: ReturnType<typeof uploadAddStatus>
|
||||
): IUploadState => assocPath(
|
||||
['statuses'],
|
||||
{ ...state.statuses, [temp_id]: { ...EMPTY_UPLOAD_STATUS, ...status } },
|
||||
{ ...state.statuses, [temp_id]: { ...EMPTY_UPLOAD_STATUS, ...status, }, },
|
||||
state
|
||||
);
|
||||
|
||||
const dropStatus = (
|
||||
state: IUploadState,
|
||||
{ temp_id }: ReturnType<typeof uploadDropStatus>
|
||||
{ temp_id, }: ReturnType<typeof uploadDropStatus>
|
||||
): IUploadState => assocPath(['statuses'], omit([temp_id], state.statuses), state);
|
||||
|
||||
const setStatus = (
|
||||
state: IUploadState,
|
||||
{ temp_id, status }: ReturnType<typeof uploadSetStatus>
|
||||
{ temp_id, status, }: ReturnType<typeof uploadSetStatus>
|
||||
): IUploadState => assocPath(
|
||||
['statuses'],
|
||||
{
|
||||
...state.statuses,
|
||||
[temp_id]: { ...(state.statuses[temp_id] || EMPTY_UPLOAD_STATUS), ...status }
|
||||
[temp_id]: { ...(state.statuses[temp_id] || EMPTY_UPLOAD_STATUS), ...status, },
|
||||
},
|
||||
state
|
||||
);
|
||||
|
||||
const addFile = (state: IUploadState, { file }: ReturnType<typeof uploadAddFile>): IUploadState => assocPath(['files'], { ...state.files, [file.id]: file }, state);
|
||||
const addFile = (state: IUploadState, { file, }: ReturnType<typeof uploadAddFile>): IUploadState => assocPath(['files'], { ...state.files, [file.id]: file, }, state);
|
||||
|
||||
export const UPLOAD_HANDLERS = {
|
||||
[UPLOAD_ACTIONS.ADD_STATUS]: addStatus,
|
||||
[UPLOAD_ACTIONS.DROP_STATUS]: dropStatus,
|
||||
[UPLOAD_ACTIONS.SET_STATUS]: setStatus,
|
||||
[UPLOAD_ACTIONS.ADD_FILE]: addFile
|
||||
[UPLOAD_ACTIONS.ADD_FILE]: addFile,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue