Added additional precuations for users that do not exist and verified auth access.
This commit is contained in:
@@ -36,17 +36,19 @@ export function* signInWithEmail({ payload: { email, password } }) {
|
||||
mutation: UPSERT_USER,
|
||||
variables: { authEmail: user.email, authToken: user.uid },
|
||||
});
|
||||
console.log("function*signInWithEmail -> result", result);
|
||||
|
||||
yield put(
|
||||
signInSuccess({
|
||||
uid: user.uid,
|
||||
email: user.email,
|
||||
displayName: user.displayName,
|
||||
photoURL: user.photoURL,
|
||||
authorized: true,
|
||||
})
|
||||
);
|
||||
if (!result.errors) {
|
||||
yield put(
|
||||
signInSuccess({
|
||||
uid: user.uid,
|
||||
email: user.email,
|
||||
displayName: user.displayName,
|
||||
photoURL: user.photoURL,
|
||||
authorized: true,
|
||||
})
|
||||
);
|
||||
} else {
|
||||
yield put(signInFailure(JSON.stringify(result.errors)));
|
||||
}
|
||||
} catch (error) {
|
||||
yield put(signInFailure(error));
|
||||
}
|
||||
@@ -100,6 +102,7 @@ export function* updateUserDetails(userDetails) {
|
||||
} catch (error) {
|
||||
//yield put(signOutFailure(error.message));
|
||||
//TODO error handling
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,13 +114,17 @@ export function* signInSuccessSaga({ payload }) {
|
||||
//Query for the Correct Bodyshop
|
||||
|
||||
const shop = yield client.query({ query: QUERY_BODYSHOP });
|
||||
|
||||
yield put(setBodyshop(shop.data.bodyshops[0]));
|
||||
ipcRenderer.send(
|
||||
ipcTypes.default.app.toMain.setAcceptableInsCoNm,
|
||||
shop.data.bodyshops[0].accepted_ins_co
|
||||
);
|
||||
ipcRenderer.send(ipcTypes.default.fileWatcher.toMain.start);
|
||||
if (shop.data.bodyshops.length > 0) {
|
||||
yield put(setBodyshop(shop.data.bodyshops[0]));
|
||||
ipcRenderer.send(
|
||||
ipcTypes.default.app.toMain.setAcceptableInsCoNm,
|
||||
shop.data.bodyshops[0].accepted_ins_co
|
||||
);
|
||||
ipcRenderer.send(ipcTypes.default.fileWatcher.toMain.start);
|
||||
} else {
|
||||
console.log("No bodyshop has been associated.");
|
||||
yield put(setBodyshop(false));
|
||||
}
|
||||
// LogRocket.identify(payload.email);
|
||||
// if (!payload.email.includes("@imex.")) yield put(setInstanceId(payload.uid));
|
||||
// yield logImEXEvent("redux_sign_in_success");
|
||||
|
||||
Reference in New Issue
Block a user