--- a/client/src/sagas/authSaga.js Thu Dec 06 01:35:30 2018 +0100
+++ b/client/src/sagas/authSaga.js Tue Dec 18 02:27:22 2018 +0100
@@ -100,6 +100,33 @@
}
}
+export function* watchResetSubmit() {
+ while (true) {
+ const { email } = yield take(types.AUTH_RESET_SUBMIT);
+ yield put({ type: types.AUTH_RESET_REQUEST, email });
+ }
+}
+
+
+function* watchResetRequest(context) {
+ while (true) {
+ try {
+
+ const { email } = yield take(types.AUTH_RESET_REQUEST);
+
+ const client = context.client;
+ yield client.post('/api/auth/password/reset/', { email });
+
+ context.history.push('/sessions');
+
+ } catch(e) {
+ yield put({ type: types.AUTH_RESET_ERROR, error: e });
+ }
+ }
+}
+
+
+
// ---
export default function* rootSaga(context) {
@@ -110,5 +137,7 @@
watchRegisterRequest(context),
watchStoreToken(),
watchUpdateSettings(context),
+ watchResetSubmit(),
+ watchResetRequest(context),
])
}