import {adminCharacters, adminCharactersDelete} from 'src/api/admin';
export default { namespace: 'roleAdmin', state: { dataSource: [], }, effects: { * fetchData ({id}, {call, put, select}) { const {data} = yield call(adminCharacters); yield put({ type: 'save', payload: { dataSource: data, }, }); }, * deleteData ({id, cb}, {call, put}) { const {success} = yield call(adminCharactersDelete, id); if (success) { cb() } }, }, reducers: { save(state, {payload}) { return {...state, ...payload}; }, }, };
|