Refactor decode to match existing partner.
This commit is contained in:
@@ -19,5 +19,5 @@ export interface DecodedStlLine {
|
||||
ttl_amt?: number;
|
||||
}
|
||||
export interface DecodedStl {
|
||||
cieca_stl: DecodedStlLine[];
|
||||
cieca_stl: { data: DecodedStlLine[] };
|
||||
}
|
||||
|
||||
@@ -57,6 +57,6 @@ const DecodeStl = async (
|
||||
//Apply business logic transfomrations.
|
||||
//We don't have an inspection date, we instead have `date_estimated`
|
||||
|
||||
return { cieca_stl: rawStlData };
|
||||
return { cieca_stl: { data: rawStlData } };
|
||||
};
|
||||
export default DecodeStl;
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface VehicleRecordInterface {
|
||||
impact2?: string;
|
||||
};
|
||||
// Paint code information
|
||||
paint_codes: {
|
||||
v_paint_codes: {
|
||||
paint_cd1: string;
|
||||
paint_cd2: string;
|
||||
paint_cd3: string;
|
||||
|
||||
@@ -77,7 +77,7 @@ const DecodeVeh = async (
|
||||
delete rawVehData.impact_2;
|
||||
|
||||
//Consolidate Paint Code information.
|
||||
rawVehData.paint_codes = {
|
||||
rawVehData.v_paint_codes = {
|
||||
paint_cd1: rawVehData.paint_cd1 ?? "",
|
||||
paint_cd2: rawVehData.paint_cd2 ?? "",
|
||||
paint_cd3: rawVehData.paint_cd3 ?? "",
|
||||
|
||||
@@ -34,4 +34,13 @@ export const { increment, decrement, incrementByAmount } = appSlice.actions;
|
||||
// Other code such as selectors can use the imported `RootState` type
|
||||
export const selectCount = (state: RootState): number => state.app.value;
|
||||
|
||||
//Async Functions - Thunks
|
||||
// Define a thunk that dispatches those action creators
|
||||
const fetchUsers = () => async (dispatch) => {
|
||||
dispatch(increment());
|
||||
//Some sort of async action.
|
||||
|
||||
dispatch(incrementByAmount(100));
|
||||
};
|
||||
|
||||
export default appSlice.reducer;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import logger from "redux-logger";
|
||||
import appReducer from "./app.slice";
|
||||
|
||||
const store = configureStore({
|
||||
reducer: { app: appReducer },
|
||||
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(logger),
|
||||
});
|
||||
|
||||
// Infer the `RootState` and `AppDispatch` types from the store itself
|
||||
|
||||
@@ -2,7 +2,8 @@ import type { TypedUseSelectorHook } from "react-redux";
|
||||
import { useDispatch, useSelector, useStore } from "react-redux";
|
||||
import type { AppDispatch, AppStore, RootState } from "./redux-store";
|
||||
|
||||
// Use throughout your app instead of plain `useDispatch` and `useSelector`
|
||||
|
||||
//Use these custom hooks to access the Redux store from your component with type safety.
|
||||
export const useAppDispatch: () => AppDispatch = useDispatch;
|
||||
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
||||
export const useAppStore: () => AppStore = useStore;
|
||||
|
||||
12
src/renderer/src/util/ipcRendererHandler.ts
Normal file
12
src/renderer/src/util/ipcRendererHandler.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
//Set up all of the IPC handlers.
|
||||
import ipcTypes from "../../../util/ipcTypes.json";
|
||||
|
||||
const ipcRenderer = window.electron.ipcRenderer;
|
||||
|
||||
ipcRenderer.on(
|
||||
ipcTypes.toRenderer.test,
|
||||
(event: Electron.IpcRendererEvent, arg) => {
|
||||
console.log("Received test message from main process");
|
||||
console.log(arg);
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user