Added further logging. RPS-4

This commit is contained in:
Patrick Fic
2020-10-22 20:57:01 -07:00
parent dc086cb5eb
commit 658f45b476
9 changed files with 123 additions and 94 deletions

View File

@@ -1,3 +1,4 @@
import ipcTypes from "../../ipc.types";
import ApplicationActionTypes from "./application.types";
const INITIAL_STATE = {
watcherStatus: "Not Started",
@@ -8,6 +9,8 @@ const INITIAL_STATE = {
settings: {},
};
const { ipcRenderer } = window;
const applicationReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case ApplicationActionTypes.SET_WATCHED_PATHS:
@@ -16,11 +19,17 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
watchedPaths: action.payload,
};
case ApplicationActionTypes.ADD_WATCHED_PATH:
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
event: "ADD_WATCHED_PATH",
});
return {
...state,
watchedPaths: [...state.watchedPaths, action.payload],
};
case ApplicationActionTypes.REMOVE_WATCHED_PATH:
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
event: "REMOVE_WATCHED_PATH",
});
return {
...state,
watchedPaths: state.watchedPaths.filter((p) => p !== action.payload),
@@ -31,6 +40,10 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
watcherStatus: action.payload,
};
case ApplicationActionTypes.SET_WATCHER_ERROR:
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
event: "WATCHER_ERROR",
error: action.payload,
});
return {
...state,
watcherError: action.payload,
@@ -41,6 +54,9 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
selectedJobTargetPc: action.payload,
};
case ApplicationActionTypes.SET_SELECTED_JOB_ID:
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
event: "SET_SELECTED_JOB",
});
return { ...state, selectedJobId: action.payload };
case ApplicationActionTypes.SET_SETTINGS:
return { ...state, settings: { ...state.settings, ...action.payload } };