Commit f8dd3d06 authored by 张烨's avatar 张烨

feat: update

parent 03d16e7a
import { connect } from 'react-redux';
import { isImmutable } from 'immutable';
import * as actionCreators from './actions';
import * as constants from './constants';
import reducer from './reducer';
import * as selectors from './selectors';
const mapState = store => {
const storeObj = store.toJS();
const storeObj = isImmutable(store) ? store.toJS() : store;
return {
global: storeObj.global,
auth: storeObj.global.auth,
......@@ -14,7 +15,10 @@ const mapState = store => {
};
const mapDispatch = dispatch => ({
setAuth: auth => dispatch(actionCreators.setAuth(auth)),
logout: () => dispatch(actionCreators.setAuth([])),
logout: () => {
localStorage.setItem('token', '');
dispatch(actionCreators.setAuth([]));
},
setUserMode: userMode => dispatch(actionCreators.setUserMode(userMode)),
});
......
......@@ -18,4 +18,10 @@ const post = async (url, params, options = {}) =>
...options,
});
export { get, post };
const postForm = async (url, params = {}, options = {}) => {
const formData = new FormData();
Object.keys(params).forEach(k => formData.append(k.trim(), params[k]));
return post(url, formData, options);
};
export { get, post, postForm };
// import sha from 'sha1';
import { CITY_SERVICE, get, post, PUBLISH_SERVICE } from '../index';
import { CITY_SERVICE, get, post, postForm, PUBLISH_SERVICE } from '../index';
export const getUserInfo = param => get('/cityinterface/getUserinfo', param);
export const login = param =>
get(`${CITY_SERVICE}/OMS.svc/L_GetCheckUser`, param);
export const OMSLogin = (loginName, password) => {
const formData = new FormData();
formData.append('userName', loginName);
formData.append('password', password);
return post(`${PUBLISH_SERVICE}/OMSLogin`, formData);
};
export const OMSLogin = (loginName, password) =>
postForm({ loginName, password });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment