This commit is contained in:
zuiidea
2016-10-28 00:29:49 +08:00
parent 4642ba700c
commit 8960d4666e
9 changed files with 257 additions and 40 deletions
+36
View File
@@ -0,0 +1,36 @@
import {login} from '../services/app'
import {parse} from 'qs'
export default {
namespace : 'app',
state : {
login: false,
loading: false,
loginButtonLoading: false
},
effects : {
*login({
payload
}, {call, put}) {
yield put({ type: 'showButtonLoading' })
const data = yield call(login, parse(payload))
if (data) {
yield put({type: 'loginSuccess', payload: {
data
}})
}
}
},
reducers : {
loginSuccess(state) {
return {
login: true,
loading: false,
loginButtonLoading: false
}
},
showLoading(state) {
return { ...state, loginButtonLoading: true }
}
}
}
-15
View File
@@ -1,15 +0,0 @@
// export default {
// namespace: 'login',
// state: {
// list: [],
// total: null,
// },
// effects: {
// *query(){},
// },
// reducers: {
// loginSuccess(){
//
// }
// }
// }