Last active
December 18, 2016 03:58
-
-
Save Ellisande/bbe188be57a379eea67ddc69b2a01000 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hateBattle = async function(battleName, userToken){ | |
const result = await axios.post(`/v1/battle/${battleName}/hate`, {}, createConfig(userToken)); | |
return result.data; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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