15 lines
294 B
JavaScript
15 lines
294 B
JavaScript
|
const dialogReducer = (state = [], action) => {
|
||
|
switch(action.type) {
|
||
|
case 'dialog_addmsg':
|
||
|
return [...state, {
|
||
|
msg: action.msg,
|
||
|
act: action.act || null
|
||
|
}];
|
||
|
case 'dialog_remove_first':
|
||
|
return state.slice(1);
|
||
|
default:
|
||
|
return state;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default dialogReducer;
|