Added bodyshop querying before starting application. Basic job query and list view.
This commit is contained in:
@@ -10,7 +10,11 @@ const sagaMiddleWare = createSagaMiddleware();
|
||||
|
||||
const middlewares = [sagaMiddleWare];
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
middlewares.push(createLogger({ collapsed: true, diff: true }));
|
||||
middlewares.push(
|
||||
createLogger({
|
||||
collapsed: true,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const enhancer = compose(
|
||||
|
||||
@@ -15,8 +15,11 @@ import {
|
||||
updateUserDetailsSuccess,
|
||||
validatePasswordResetFailure,
|
||||
validatePasswordResetSuccess,
|
||||
setBodyshop,
|
||||
} from "./user.actions";
|
||||
import UserActionTypes from "./user.types";
|
||||
import { client } from "../../graphql/client";
|
||||
import { QUERY_BODYSHOP } from "../../graphql/bodyshop.queries";
|
||||
|
||||
export function* onEmailSignInStart() {
|
||||
yield takeLatest(UserActionTypes.EMAIL_SIGN_IN_START, signInWithEmail);
|
||||
@@ -75,7 +78,6 @@ export function* signOutStart() {
|
||||
|
||||
yield auth.signOut();
|
||||
yield put(signOutSuccess());
|
||||
localStorage.removeItem("token");
|
||||
} catch (error) {
|
||||
yield put(signOutFailure(error.message));
|
||||
}
|
||||
@@ -99,7 +101,13 @@ export function* onSignInSuccess() {
|
||||
}
|
||||
|
||||
export function* signInSuccessSaga({ payload }) {
|
||||
//yield logImEXEvent("redux_sign_in_success");
|
||||
try {
|
||||
const shop = yield client.query({ query: QUERY_BODYSHOP });
|
||||
|
||||
yield put(setBodyshop(shop.data.bodyshops[0]));
|
||||
} catch (error) {
|
||||
console.log("UHOH. Couldn't get shop details.", error);
|
||||
}
|
||||
}
|
||||
|
||||
export function* onSendPasswordResetStart() {
|
||||
|
||||
@@ -14,6 +14,7 @@ const UserActionTypes = {
|
||||
SET_USER_LANGUAGE: "SET_USER_LANGUAGE",
|
||||
UPDATE_USER_DETAILS: "UPDATE_USER_DETAILS",
|
||||
UPDATE_USER_DETAILS_SUCCESS: "UPDATE_USER_DETAILS_SUCCESS",
|
||||
QUERY_SHOP_DETAILS: "QUERY_SHOP_DETAILS",
|
||||
SET_SHOP_DETAILS: "SET_SHOP_DETAILS",
|
||||
SET_INSTANCE_ID: "SET_INSTANCE_ID",
|
||||
CHECK_INSTANCE_ID: "CHECK_INSTANCE_ID",
|
||||
|
||||
Reference in New Issue
Block a user