Skip to content
Permalink
de9fcf13f2
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
40 lines (38 sloc) 951 Bytes
import {TypeMap} from '../actions/index';
export default (state = {}, action) => {
const {payload} = action;
switch (action.type) {
case TypeMap.BORROW_MY_LIST:
state.mylist = payload;
break;
case TypeMap.BORROW_REQUEST:
state.request = payload;
break;
case TypeMap.BORROW_DELETE:
state.mylist.splice(payload.index, 1);
state.delete = payload;
break;
case TypeMap.BORROW_ADD:
state.add = payload;
break;
case TypeMap.BORROW_CONFIRM:
state.confirm = payload;
break;
case TypeMap.BORROW_DETAIL:
state.detail = payload;
break;
case TypeMap.BORROW_REFUSE:
state.refuse = payload;
break;
case TypeMap.BORROW_RETURN:
const {index, id} = payload;
// debugger
if (state.mylist[index]) {
state.mylist[index].state = 4;
}
state.return = payload;
break;
default:
}
return state;
};