Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
doAction: function* loginSaga({ username, password }) {
const { status, body } = yield post(`/api${routes.AUTH_JWT_PASSWORD}`)
.use(basicAuth(username.toLowerCase(), password));
if (status > 200 && status < 500) throw new Error(body.message || body);
else if (status >= 500) throw new Error('There was an error communicating with the login server.');
else {
yield put(tokenActions.decodeLoginTokenAction(body));
yield put(routerActions.navigateTo('home'));
}
}
});
postModel = (schema, props, params = {}) =>
post(this.constructRequest(schema, params, props, props))