mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
added boris reducer
This commit is contained in:
parent
381c2fecda
commit
6595adcccd
4 changed files with 52 additions and 22 deletions
1
src/redux/boris/handlers.ts
Normal file
1
src/redux/boris/handlers.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export const BORIS_HANDLERS = {};
|
22
src/redux/boris/reducer.ts
Normal file
22
src/redux/boris/reducer.ts
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import { createReducer } from '~/utils/reducer';
|
||||||
|
import { BORIS_HANDLERS } from './handlers';
|
||||||
|
|
||||||
|
export type IStatGitRow = {
|
||||||
|
commit: string;
|
||||||
|
subject: string;
|
||||||
|
timestamp: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type IBorisState = Readonly<{
|
||||||
|
stats: {
|
||||||
|
git: IStatGitRow[];
|
||||||
|
};
|
||||||
|
}>;
|
||||||
|
|
||||||
|
const BORIS_INITIAL_STATE: IBorisState = {
|
||||||
|
stats: {
|
||||||
|
git: [],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default createReducer(BORIS_INITIAL_STATE, BORIS_HANDLERS);
|
1
src/redux/boris/sagas.ts
Normal file
1
src/redux/boris/sagas.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export default function* borisSaga() {}
|
|
@ -7,27 +7,30 @@ import { connectRouter, RouterState, routerMiddleware } from 'connected-react-ro
|
||||||
import { createBrowserHistory } from 'history';
|
import { createBrowserHistory } from 'history';
|
||||||
import { PersistConfig, Persistor } from 'redux-persist/es/types';
|
import { PersistConfig, Persistor } from 'redux-persist/es/types';
|
||||||
|
|
||||||
import authReducer from '~/redux/auth/reducer';
|
import auth from '~/redux/auth/reducer';
|
||||||
import authSaga from '~/redux/auth/sagas';
|
import authSaga from '~/redux/auth/sagas';
|
||||||
|
|
||||||
import nodeReducer, { INodeState } from '~/redux/node/reducer';
|
|
||||||
import nodeSaga from '~/redux/node/sagas';
|
|
||||||
|
|
||||||
import flowReducer, { IFlowState } from '~/redux/flow/reducer';
|
|
||||||
import flowSaga from '~/redux/flow/sagas';
|
|
||||||
|
|
||||||
import uploadReducer, { IUploadState } from '~/redux/uploads/reducer';
|
|
||||||
import uploadSaga from '~/redux/uploads/sagas';
|
|
||||||
|
|
||||||
import playerReducer, { IPlayerState } from '~/redux/player/reducer';
|
|
||||||
import playerSaga from '~/redux/player/sagas';
|
|
||||||
|
|
||||||
import { IAuthState } from '~/redux/auth/types';
|
import { IAuthState } from '~/redux/auth/types';
|
||||||
|
|
||||||
import modalReducer, { IModalState } from '~/redux/modal/reducer';
|
import node, { INodeState } from '~/redux/node/reducer';
|
||||||
import { gotAuthPostMessage, authOpenProfile } from './auth/actions';
|
import nodeSaga from '~/redux/node/sagas';
|
||||||
|
|
||||||
|
import flow, { IFlowState } from '~/redux/flow/reducer';
|
||||||
|
import flowSaga from '~/redux/flow/sagas';
|
||||||
|
|
||||||
|
import uploads, { IUploadState } from '~/redux/uploads/reducer';
|
||||||
|
import uploadSaga from '~/redux/uploads/sagas';
|
||||||
|
|
||||||
|
import player, { IPlayerState } from '~/redux/player/reducer';
|
||||||
|
import playerSaga from '~/redux/player/sagas';
|
||||||
|
|
||||||
|
import modal, { IModalState } from '~/redux/modal/reducer';
|
||||||
import { modalSaga } from './modal/sagas';
|
import { modalSaga } from './modal/sagas';
|
||||||
|
|
||||||
|
import { gotAuthPostMessage, authOpenProfile } from './auth/actions';
|
||||||
|
|
||||||
|
import boris, { IBorisState } from './boris/reducer';
|
||||||
|
import borisSaga from './boris/sagas';
|
||||||
|
|
||||||
const authPersistConfig: PersistConfig = {
|
const authPersistConfig: PersistConfig = {
|
||||||
key: 'auth',
|
key: 'auth',
|
||||||
whitelist: ['token', 'user', 'updates'],
|
whitelist: ['token', 'user', 'updates'],
|
||||||
|
@ -54,6 +57,7 @@ export interface IState {
|
||||||
uploads: IUploadState;
|
uploads: IUploadState;
|
||||||
flow: IFlowState;
|
flow: IFlowState;
|
||||||
player: IPlayerState;
|
player: IPlayerState;
|
||||||
|
boris: IBorisState;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const sagaMiddleware = createSagaMiddleware();
|
export const sagaMiddleware = createSagaMiddleware();
|
||||||
|
@ -66,13 +70,14 @@ const composeEnhancers =
|
||||||
|
|
||||||
export const store = createStore(
|
export const store = createStore(
|
||||||
combineReducers<IState>({
|
combineReducers<IState>({
|
||||||
auth: persistReducer(authPersistConfig, authReducer),
|
auth: persistReducer(authPersistConfig, auth),
|
||||||
modal: modalReducer,
|
modal,
|
||||||
|
boris,
|
||||||
router: connectRouter(history),
|
router: connectRouter(history),
|
||||||
node: nodeReducer,
|
node,
|
||||||
uploads: uploadReducer,
|
uploads,
|
||||||
flow: persistReducer(flowPersistConfig, flowReducer),
|
flow: persistReducer(flowPersistConfig, flow),
|
||||||
player: persistReducer(playerPersistConfig, playerReducer),
|
player: persistReducer(playerPersistConfig, player),
|
||||||
}),
|
}),
|
||||||
composeEnhancers(applyMiddleware(routerMiddleware(history), sagaMiddleware))
|
composeEnhancers(applyMiddleware(routerMiddleware(history), sagaMiddleware))
|
||||||
);
|
);
|
||||||
|
@ -87,6 +92,7 @@ export function configureStore(): {
|
||||||
sagaMiddleware.run(flowSaga);
|
sagaMiddleware.run(flowSaga);
|
||||||
sagaMiddleware.run(playerSaga);
|
sagaMiddleware.run(playerSaga);
|
||||||
sagaMiddleware.run(modalSaga);
|
sagaMiddleware.run(modalSaga);
|
||||||
|
sagaMiddleware.run(borisSaga);
|
||||||
|
|
||||||
window.addEventListener('message', message => {
|
window.addEventListener('message', message => {
|
||||||
if (message && message.data && message.data.type === 'oauth_login' && message.data.token)
|
if (message && message.data && message.data.type === 'oauth_login' && message.data.token)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue