Skip to content

Commit 0f761e9

Browse files
author
苗园园
committed
fix(fix store): fix store
fix store fix store
1 parent c3a6cb5 commit 0f761e9

12 files changed

+516
-99
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).
1+
<!--This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).-->
22

33
Below you will find some information on how to perform common tasks.<br>
44
You can find the most recent version of this guide [here](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md).

package-lock.json

+32-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"dependencies": {
66
"6": "^0.0.1",
77
"antd": "^3.1.6",
8+
"axios": "^0.17.1",
89
"babel-core": "^6.26.0",
910
"babel-plugin-transform-class-properties": "^6.24.1",
1011
"babel-plugin-transform-decorators": "^6.24.1",
@@ -25,8 +26,11 @@
2526
"react-router-redux": "next",
2627
"react-scripts": "1.1.0",
2728
"redux": "^3.7.2",
29+
"redux-axios-middleware": "^4.0.0",
2830
"redux-logger": "^3.0.6",
29-
"redux-thunk": "^2.2.0"
31+
"redux-persist": "^5.5.0",
32+
"redux-thunk": "^2.2.0",
33+
"standard-error": "^1.1.0"
3034
},
3135
"scripts": {
3236
"build-css": "node-sass-chokidar src/ -o src/",

public/favicon.ico

17.8 KB
Binary file not shown.

src/components/#/#.js

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import './#.css';
44

55
const FormItem = Form.Item;
66

7+
// 疑似由于babel版本过新
78
// @Form.create()
89

910
export class Login extends React.Component {

src/reducers/counter.js

+19-86
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,28 @@
1-
export const INCREMENT_REQUESTED = 'counter/INCREMENT_REQUESTED'
2-
export const INCREMENT = 'counter/INCREMENT'
3-
export const DECREMENT_REQUESTED = 'counter/DECREMENT_REQUESTED'
4-
export const DECREMENT = 'counter/DECREMENT'
1+
import cFetch from './../utils/cFetch';
2+
import {
3+
PERSONAL_SVAE_ROLE_DATA_PENDING,
4+
PERSONAL_SVAE_ROLE_DATA_FULFILLED,
5+
PERSONAL_SVAE_ROLE_DATA_REJECTED,
6+
} from './../constants/actionTypes';
57

6-
const initialState = {
7-
count: 0,
8-
isIncrementing: false,
9-
isDecrementing: false
10-
}
8+
const API_CONFIG = window.API_CONFIG;
119

12-
export default (state = initialState, action) => {
10+
export default function (state = { }, action) {
1311
switch (action.type) {
14-
case INCREMENT_REQUESTED:
15-
return {
16-
...state,
17-
isIncrementing: true
18-
}
19-
20-
case INCREMENT:
21-
return {
22-
...state,
23-
count: state.count + 1,
24-
isIncrementing: !state.isIncrementing
25-
}
26-
27-
case DECREMENT_REQUESTED:
12+
case PERSONAL_SVAE_ROLE_DATA_FULFILLED:
2813
return {
2914
...state,
30-
isDecrementing: true
31-
}
32-
33-
case DECREMENT:
34-
return {
35-
...state,
36-
count: state.count - 1,
37-
isDecrementing: !state.isDecrementing
38-
}
39-
15+
presonSaveRoleData: action.payload,
16+
};
4017
default:
41-
return state
42-
}
43-
}
44-
45-
export const increment = () => {
46-
return dispatch => {
47-
dispatch({
48-
type: INCREMENT_REQUESTED
49-
})
50-
51-
dispatch({
52-
type: INCREMENT
53-
})
18+
return state;
5419
}
5520
}
5621

57-
export const incrementAsync = () => {
58-
return dispatch => {
59-
dispatch({
60-
type: INCREMENT_REQUESTED
61-
})
62-
63-
return setTimeout(() => {
64-
dispatch({
65-
type: INCREMENT
66-
})
67-
}, 3000)
68-
}
69-
}
70-
71-
export const decrement = () => {
72-
return dispatch => {
73-
dispatch({
74-
type: DECREMENT_REQUESTED
75-
})
76-
77-
dispatch({
78-
type: DECREMENT
79-
})
80-
}
81-
}
82-
83-
export const decrementAsync = () => {
84-
return dispatch => {
85-
dispatch({
86-
type: DECREMENT_REQUESTED
87-
})
88-
89-
return setTimeout(() => {
90-
dispatch({
91-
type: DECREMENT
92-
})
93-
}, 3000)
94-
}
95-
}
22+
// 保存角色信息
23+
export function presonSaveRole(params) {
24+
return {
25+
type: PERSONAL_SVAE_ROLE_DATA_FULFILLED,
26+
payload: cFetch(API_CONFIG.GET_ALL_ROLELIST, { method: 'PUT', body: JSON.stringify(params)}),
27+
};
28+
}

src/store/store.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createStore, applyMiddleware, compose } from 'redux'
22
import { routerMiddleware } from 'react-router-redux'
33
import thunk from 'redux-thunk'
44
import createHistory from 'history/createBrowserHistory'
5-
import rootReducer from '../reducers';
5+
import rootReducer from '../reducers'
66

77
export const history = createHistory()
88

0 commit comments

Comments
 (0)