mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
redux: initial
This commit is contained in:
parent
0fcd0bd209
commit
dca55a3bc4
6 changed files with 55 additions and 54 deletions
29
package-lock.json
generated
29
package-lock.json
generated
|
@ -10415,11 +10415,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-router-redux": {
|
|
||||||
"version": "4.0.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/react-router-redux/-/react-router-redux-4.0.8.tgz",
|
|
||||||
"integrity": "sha1-InQDWWtRUeGCN32rg1tdRfD4BU4="
|
|
||||||
},
|
|
||||||
"read-chunk": {
|
"read-chunk": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/read-chunk/-/read-chunk-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/read-chunk/-/read-chunk-2.1.0.tgz",
|
||||||
|
@ -10560,11 +10555,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"redux": {
|
"redux": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/redux/-/redux-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/redux/-/redux-4.0.1.tgz",
|
||||||
"integrity": "sha512-NnnHF0h0WVE/hXyrB6OlX67LYRuaf/rJcbWvnHHEPCF/Xa/AZpwhs/20WyqzQae5x4SD2F9nPObgBh2rxAgLiA==",
|
"integrity": "sha512-R7bAtSkk7nY6O/OYMVR9RiBI+XghjF9rlbl5806HJbQph0LJVHZrU5oaO4q70eUKiqMRqm4y07KLTlMZ2BlVmg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"loose-envify": "^1.1.0",
|
"loose-envify": "^1.4.0",
|
||||||
"symbol-observable": "^1.2.0"
|
"symbol-observable": "^1.2.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -10581,9 +10576,9 @@
|
||||||
"integrity": "sha512-sSJAzNq7zka3qVHKce1hbvqf0Vf5DuTVm7dr4GtsqQVOexnrvbV47RWFiPxQ8fscnyiuWyD2O92DOxPl0tGCRg=="
|
"integrity": "sha512-sSJAzNq7zka3qVHKce1hbvqf0Vf5DuTVm7dr4GtsqQVOexnrvbV47RWFiPxQ8fscnyiuWyD2O92DOxPl0tGCRg=="
|
||||||
},
|
},
|
||||||
"redux-saga": {
|
"redux-saga": {
|
||||||
"version": "0.16.0",
|
"version": "0.16.2",
|
||||||
"resolved": "https://registry.npmjs.org/redux-saga/-/redux-saga-0.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/redux-saga/-/redux-saga-0.16.2.tgz",
|
||||||
"integrity": "sha1-CiMdsKFIkwHdmA9vL4jYztQY9yQ="
|
"integrity": "sha512-iIjKnRThI5sKPEASpUvySemjzwqwI13e3qP7oLub+FycCRDysLSAOwt958niZW6LhxfmS6Qm1BzbU70w/Koc4w=="
|
||||||
},
|
},
|
||||||
"reduxsauce": {
|
"reduxsauce": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
@ -12049,11 +12044,6 @@
|
||||||
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
|
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"typeface-montserrat": {
|
|
||||||
"version": "0.0.54",
|
|
||||||
"resolved": "https://registry.npmjs.org/typeface-montserrat/-/typeface-montserrat-0.0.54.tgz",
|
|
||||||
"integrity": "sha512-Typhap0PWT299+Va0G/8ZtycHMXrH4gBWKfiW977KEBx5rXUUCa70gvqLx1fdA0WAo6bhSAQmo8uc+QFAmjPww=="
|
|
||||||
},
|
|
||||||
"ua-parser-js": {
|
"ua-parser-js": {
|
||||||
"version": "0.7.18",
|
"version": "0.7.18",
|
||||||
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.18.tgz",
|
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.18.tgz",
|
||||||
|
@ -13124,11 +13114,6 @@
|
||||||
"integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==",
|
"integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"wfk-montserrat": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/wfk-montserrat/-/wfk-montserrat-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-XgRPn20Qp20BHs1UXyvMVQgblHSwl3bMhrNeXF921fqxIOT0ZPMynqWa60q5wU5RkRTxQfZsgv0Rt6prMSpvhQ=="
|
|
||||||
},
|
|
||||||
"whatwg-fetch": {
|
"whatwg-fetch": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz",
|
||||||
|
|
|
@ -64,6 +64,10 @@
|
||||||
"react-hot-loader": "^4.1.1",
|
"react-hot-loader": "^4.1.1",
|
||||||
"react-redux": "^5.0.7",
|
"react-redux": "^5.0.7",
|
||||||
"react-router": "^4.3.1",
|
"react-router": "^4.3.1",
|
||||||
|
"redux": "^4.0.1",
|
||||||
|
"redux-persist": "^5.10.0",
|
||||||
|
"redux-saga": "^0.16.2",
|
||||||
|
"reduxsauce": "^1.0.0",
|
||||||
"scrypt": "^6.0.3",
|
"scrypt": "^6.0.3",
|
||||||
"styled-components": "^3.2.6",
|
"styled-components": "^3.2.6",
|
||||||
"styled-theming": "^2.2.0",
|
"styled-theming": "^2.2.0",
|
||||||
|
|
|
@ -10,6 +10,12 @@ import { getGuestToken, checkUserToken, getStoredMap } from '$utils/api';
|
||||||
import { storeData, getData } from '$utils/storage';
|
import { storeData, getData } from '$utils/storage';
|
||||||
import { UserPanel } from '$components/panels/UserPanel';
|
import { UserPanel } from '$components/panels/UserPanel';
|
||||||
import { getUrlData, pushPath } from '$utils/history';
|
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 {
|
export class App extends React.Component {
|
||||||
state = {
|
state = {
|
||||||
|
@ -68,7 +74,6 @@ export class App extends React.Component {
|
||||||
|
|
||||||
setTitle = title => this.setState({ title });
|
setTitle = title => this.setState({ title });
|
||||||
setAddress = address => {
|
setAddress = address => {
|
||||||
console.log('SAT', address);
|
|
||||||
this.setState({ address });
|
this.setState({ address });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -204,33 +209,37 @@ export class App extends React.Component {
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<Provider store={store}>
|
||||||
<Fills />
|
<PersistGate loading={null} persistor={persistor}>
|
||||||
|
<div>
|
||||||
|
<Fills />
|
||||||
|
|
||||||
<UserLocation editor={editor} />
|
<UserLocation editor={editor} />
|
||||||
|
|
||||||
<UserPanel
|
<UserPanel
|
||||||
editor={editor}
|
editor={editor}
|
||||||
user={user}
|
user={user}
|
||||||
setUser={this.setUser}
|
setUser={this.setUser}
|
||||||
userLogout={this.userLogout}
|
userLogout={this.userLogout}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<EditorPanel
|
<EditorPanel
|
||||||
editor={editor}
|
editor={editor}
|
||||||
mode={mode}
|
mode={mode}
|
||||||
routerPoints={routerPoints}
|
routerPoints={routerPoints}
|
||||||
totalDistance={totalDistance}
|
totalDistance={totalDistance}
|
||||||
estimateTime={estimateTime}
|
estimateTime={estimateTime}
|
||||||
activeSticker={activeSticker}
|
activeSticker={activeSticker}
|
||||||
logo={logo}
|
logo={logo}
|
||||||
user={user}
|
user={user}
|
||||||
editing={editing}
|
editing={editing}
|
||||||
title={title}
|
title={title}
|
||||||
address={address}
|
address={address}
|
||||||
changed={changed}
|
changed={changed}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</PersistGate>
|
||||||
|
</Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export const AUTH_ACTIONS = {
|
export const ACTIONS = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { createReducer } from 'reduxsauce';
|
import { createReducer } from 'reduxsauce';
|
||||||
import { AUTH_ACTIONS, EMPTY_USER } from '$redux/auth/constants';
|
import { ACTIONS, EMPTY_USER } from '$redux/auth/constants';
|
||||||
|
|
||||||
const HANDLERS = {
|
const HANDLERS = {
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { persistStore, persistReducer } from 'redux-persist';
|
||||||
import storage from 'redux-persist/lib/storage';
|
import storage from 'redux-persist/lib/storage';
|
||||||
import createSagaMiddleware from 'redux-saga';
|
import createSagaMiddleware from 'redux-saga';
|
||||||
import createHistory from 'history/createBrowserHistory';
|
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 { authReducer } from '$redux/auth/reducer';
|
||||||
import { authSaga } from '$redux/auth/sagas';
|
import { authSaga } from '$redux/auth/sagas';
|
||||||
|
@ -27,17 +27,20 @@ const composeEnhancers =
|
||||||
: compose;
|
: compose;
|
||||||
/* eslint-enable no-underscore-dangle */
|
/* eslint-enable no-underscore-dangle */
|
||||||
|
|
||||||
export const history = createHistory();
|
// export const history = createHistory();
|
||||||
|
|
||||||
export const store = createStore(
|
export const store = createStore(
|
||||||
combineReducers({
|
combineReducers({
|
||||||
auth: persistReducer(authPersistConfig, authReducer),
|
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
|
// run sagas
|
||||||
sagaMiddleware.run(authSaga);
|
sagaMiddleware.run(authSaga);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue