mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
redux: initial
This commit is contained in:
parent
0fcd0bd209
commit
dca55a3bc4
6 changed files with 55 additions and 54 deletions
|
@ -10,6 +10,12 @@ import { getGuestToken, checkUserToken, getStoredMap } from '$utils/api';
|
|||
import { storeData, getData } from '$utils/storage';
|
||||
import { UserPanel } from '$components/panels/UserPanel';
|
||||
import { getUrlData, pushPath } from '$utils/history';
|
||||
import { Provider } from 'react-redux';
|
||||
import { PersistGate } from 'redux-persist/integration/react';
|
||||
|
||||
import { configureStore } from '$redux/store';
|
||||
|
||||
const { store, persistor } = configureStore();
|
||||
|
||||
export class App extends React.Component {
|
||||
state = {
|
||||
|
@ -68,7 +74,6 @@ export class App extends React.Component {
|
|||
|
||||
setTitle = title => this.setState({ title });
|
||||
setAddress = address => {
|
||||
console.log('SAT', address);
|
||||
this.setState({ address });
|
||||
};
|
||||
|
||||
|
@ -204,33 +209,37 @@ export class App extends React.Component {
|
|||
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Fills />
|
||||
<Provider store={store}>
|
||||
<PersistGate loading={null} persistor={persistor}>
|
||||
<div>
|
||||
<Fills />
|
||||
|
||||
<UserLocation editor={editor} />
|
||||
<UserLocation editor={editor} />
|
||||
|
||||
<UserPanel
|
||||
editor={editor}
|
||||
user={user}
|
||||
setUser={this.setUser}
|
||||
userLogout={this.userLogout}
|
||||
/>
|
||||
<UserPanel
|
||||
editor={editor}
|
||||
user={user}
|
||||
setUser={this.setUser}
|
||||
userLogout={this.userLogout}
|
||||
/>
|
||||
|
||||
<EditorPanel
|
||||
editor={editor}
|
||||
mode={mode}
|
||||
routerPoints={routerPoints}
|
||||
totalDistance={totalDistance}
|
||||
estimateTime={estimateTime}
|
||||
activeSticker={activeSticker}
|
||||
logo={logo}
|
||||
user={user}
|
||||
editing={editing}
|
||||
title={title}
|
||||
address={address}
|
||||
changed={changed}
|
||||
/>
|
||||
</div>
|
||||
<EditorPanel
|
||||
editor={editor}
|
||||
mode={mode}
|
||||
routerPoints={routerPoints}
|
||||
totalDistance={totalDistance}
|
||||
estimateTime={estimateTime}
|
||||
activeSticker={activeSticker}
|
||||
logo={logo}
|
||||
user={user}
|
||||
editing={editing}
|
||||
title={title}
|
||||
address={address}
|
||||
changed={changed}
|
||||
/>
|
||||
</div>
|
||||
</PersistGate>
|
||||
</Provider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export const AUTH_ACTIONS = {
|
||||
export const ACTIONS = {
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { createReducer } from 'reduxsauce';
|
||||
import { AUTH_ACTIONS, EMPTY_USER } from '$redux/auth/constants';
|
||||
import { ACTIONS, EMPTY_USER } from '$redux/auth/constants';
|
||||
|
||||
const HANDLERS = {
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { persistStore, persistReducer } from 'redux-persist';
|
|||
import storage from 'redux-persist/lib/storage';
|
||||
import createSagaMiddleware from 'redux-saga';
|
||||
import createHistory from 'history/createBrowserHistory';
|
||||
import { routerReducer, routerMiddleware } from 'react-router-redux';
|
||||
// import { routerReducer, routerMiddleware } from 'react-router-redux';
|
||||
|
||||
import { authReducer } from '$redux/auth/reducer';
|
||||
import { authSaga } from '$redux/auth/sagas';
|
||||
|
@ -27,17 +27,20 @@ const composeEnhancers =
|
|||
: compose;
|
||||
/* eslint-enable no-underscore-dangle */
|
||||
|
||||
export const history = createHistory();
|
||||
// export const history = createHistory();
|
||||
|
||||
export const store = createStore(
|
||||
combineReducers({
|
||||
auth: persistReducer(authPersistConfig, authReducer),
|
||||
routing: routerReducer
|
||||
// routing: routerReducer
|
||||
}),
|
||||
composeEnhancers(applyMiddleware(routerMiddleware(history), sagaMiddleware))
|
||||
composeEnhancers(applyMiddleware(
|
||||
// routerMiddleware(history),
|
||||
sagaMiddleware
|
||||
))
|
||||
);
|
||||
|
||||
export default function configureStore() {
|
||||
export function configureStore() {
|
||||
// run sagas
|
||||
sagaMiddleware.run(authSaga);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue