Added preloader, initial estimate decoder.

This commit is contained in:
Patrick Fic
2020-10-14 10:17:33 -07:00
parent c6f424cf5f
commit 953ea832e2
12 changed files with 306 additions and 23 deletions

View File

@@ -4,7 +4,7 @@ import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import ipcTypes from "../../../ipc.types";
const { ipcRenderer } = window.require("electron");
const { ipcRenderer } = window;
//const settings = window.require("electron-settings");
const mapStateToProps = createStructuredSelector({});
@@ -33,7 +33,7 @@ export function JobsPage() {
ipcRenderer.send("test", { test: true });
}}
>
TEST Generic IPC
TEST
</Button>
<Button
onClick={() => {

View File

@@ -0,0 +1,9 @@
import gql from "graphql-tag";
export const QUERY_BODYSHOP = gql`
query QUERY_BODYSHOP {
bodyshops {
id
shopname
}
}
`;

View File

@@ -1,12 +1,12 @@
import ipcTypes from "../ipc.types";
import { store } from "../redux/store";
import { signOutStart } from "../redux/user/user.actions";
const { ipcRenderer } = window.require("electron");
// import { store } from "../redux/store";
// import { signOutStart } from "../redux/user/user.actions";
const { ipcRenderer } = window;
console.log("----Initializing IPC Listeners in React App.");
ipcRenderer.on(ipcTypes.default.filewatcher.startSuccess, (event, obj) => {
console.log(ipcTypes.default.filewatcher.startSuccess, obj);
ipcRenderer.on(ipcTypes.default.filewatcher.startSuccess, (event, ...obj) => {
console.log(ipcTypes.default.filewatcher.startSuccess, event, obj);
store.dispatch(signOutStart());
// store.dispatch(signOutStart());
});

View File

@@ -49,7 +49,10 @@ export const updateUserDetailsSuccess = (userDetails) => ({
payload: userDetails,
});
export const setBodyshop = (bodyshop) => ({
type: UserActionTypes.SET_SHOP_DETAILS,
payload: bodyshop,
});
export const setLocalFingerprint = (fingerprint) => ({
type: UserActionTypes.SET_LOCAL_FINGERPRINT,

View File

@@ -19,9 +19,11 @@ const INITIAL_STATE = {
const userReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case UserActionTypes.SET_SHOP_DETAILS:
return { ...state, bodyshop: action.payload };
case UserActionTypes.SET_LOCAL_FINGERPRINT:
return { ...state, fingerprint: action.payload };
case UserActionTypes.VALIDATE_PASSWORD_RESET_START:
case UserActionTypes.SEND_PASSWORD_RESET_EMAIL_START:
return {
@@ -73,7 +75,6 @@ const userReducer = (state = INITIAL_STATE, action) => {
},
};
case UserActionTypes.SIGN_IN_FAILURE:
case UserActionTypes.SIGN_OUT_FAILURE:
case UserActionTypes.EMAIL_SIGN_UP_FAILURE:
@@ -81,7 +82,7 @@ const userReducer = (state = INITIAL_STATE, action) => {
...state,
error: action.payload,
};
default:
return state;
}

View File

@@ -4,6 +4,7 @@ import {
getCurrentUser,
updateCurrentUser,
} from "../../firebase/firebase.utils";
import { QUERY_BODYSHOP } from "../../graphql/bodyshop.queries";
import client from "../../graphql/GraphQLClient";
import { UPSERT_USER } from "../../graphql/user.queries";
import {
@@ -17,7 +18,9 @@ import {
updateUserDetailsSuccess,
validatePasswordResetFailure,
validatePasswordResetSuccess,
setBodyshop
} from "./user.actions";
import UserActionTypes from "./user.types";
export function* onEmailSignInStart() {
@@ -26,7 +29,6 @@ export function* onEmailSignInStart() {
export function* signInWithEmail({ payload: { email, password } }) {
try {
const { user } = yield auth.signInWithEmailAndPassword(email, password);
console.log("function*signInWithEmail -> user", user)
const result = yield client.mutate({
mutation: UPSERT_USER,
@@ -103,6 +105,11 @@ export function* onSignInSuccess() {
}
export function* signInSuccessSaga({ payload }) {
//Query for the Correct Bodyshop
const shop = yield client.query({ query: QUERY_BODYSHOP });
yield put(setBodyshop(shop.data.bodyshops[0]));
// LogRocket.identify(payload.email);
// if (!payload.email.includes("@imex.")) yield put(setInstanceId(payload.uid));
// yield logImEXEvent("redux_sign_in_success");

View File

@@ -16,3 +16,8 @@ export const selectPasswordReset = createSelector(
[selectUser],
(user) => user.passwordreset
);
export const selectBodyshop = createSelector(
[selectUser],
(user) => user.bodyshop
);