Skip to content

Instantly share code, notes, and snippets.

@Ellisande
Last active December 18, 2016 03:58
Show Gist options
  • Save Ellisande/bbe188be57a379eea67ddc69b2a01000 to your computer and use it in GitHub Desktop.
Save Ellisande/bbe188be57a379eea67ddc69b2a01000 to your computer and use it in GitHub Desktop.
const hateBattle = async function(battleName, userToken){
const result = await axios.post(`/v1/battle/${battleName}/hate`, {}, createConfig(userToken));
return result.data;
};
function* hateBattle(action){
try {
const battle = yield call(api.hateBattle, action.name, action.token);
yield put({type: 'HATE_SUCCESS', battle});
} catch(e){
const errorAction = getDefaultErrorAction(e);
yield put(errorAction);
}
}
function* hateBattleSaga(){
yield takeLatest('HATE_REQUEST', hateBattle);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment