Install node_modules
:
npm install --registry=https://registry.npm.taobao.org
or
yarn
Scripts provided in package.json
. It's safe to modify or add additional script:
npm start
npm run build
npm run lint
You can also use script to auto fix some lint error:
npm run lint:fix
npm test
- common response data
// ...code
+flag === 1 ? { items } : { msg: msg || 'response data error' };
// model
const { items, msg } = yield call(/* url */,/* params */)
- unified error handle, just deal with status code
function errorHandler(error) {
const { response } = error;
if (response.status) {
const { status, statusText, url } = response;
const errorText = codeMessage[status] || statusText;
notification.error({
message: errorText,
description: `request error ${status}: ${/[^/]*\.json/.exec(url)}`,
});
}
return response;
}
- model error capture by manual
*queryOrgs({params},{call,put}){
// ...code
throw new Error(/* error message*/)
}
export const dva = {
config: {
onError(e) {
// if it's comment,component can not capture error
e.preventDefault();
notification.error({
message: 'oops error!!!',
description: e.toString(),
});
},
},
};
- async request error capture in component
*queryOrgs(action, { call, put }) {
// ...code
return Promise.reject(/* error message*/)
}
dispatch({
type:'queryOrgs'
params: // {...}
}).catch(err=>{
// receive err message
})
- LOP: Large Open Positions
- BI: Beneficial Identity
- TO: Transaction Originator
- ECP: Electronic Communication Platform
- EP: Exchange Participant
- CA: Capital