💽 Debugging comic import
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
IMS_SOCKET_DATA_FETCHED,
|
||||
IMS_SOCKET_CONNECTION_CONNECTED,
|
||||
IMS_RAW_IMPORT_SUCCESSFUL,
|
||||
IMS_RAW_IMPORT_FAILED,
|
||||
} from "../constants/action-types";
|
||||
|
||||
export async function walkFolder(path: string): Promise<Array<IFolderData>> {
|
||||
@@ -34,13 +35,20 @@ export const rawImportToDB = (payload: any) => async (dispatch) => {
|
||||
data: {
|
||||
payload,
|
||||
},
|
||||
}).then((result) => {
|
||||
dispatch({
|
||||
type: IMS_RAW_IMPORT_SUCCESSFUL,
|
||||
rawImportCompleted: result,
|
||||
})
|
||||
.then((result) => {
|
||||
dispatch({
|
||||
type: IMS_RAW_IMPORT_SUCCESSFUL,
|
||||
rawImportDetails: result,
|
||||
});
|
||||
return result;
|
||||
})
|
||||
.catch((error) => {
|
||||
dispatch({
|
||||
type: IMS_RAW_IMPORT_FAILED,
|
||||
rawImportDetails: error,
|
||||
});
|
||||
});
|
||||
return result;
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchComicBookMetadata = (options) => async (dispatch) => {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -12,3 +12,4 @@ export const IMS_SOCKET_CONNECTION_DISCONNECTED =
|
||||
export const IMS_SOCKET_ERROR = "IMS_SOCKET_ERROR";
|
||||
|
||||
export const IMS_RAW_IMPORT_SUCCESSFUL = "IMS_RAW_IMPORT_SUCCESSFUL";
|
||||
export const IMS_RAW_IMPORT_FAILED = "IMS_RAW_IMPORT_FAILED";
|
||||
|
||||
@@ -4,12 +4,14 @@ import {
|
||||
IMS_SOCKET_DATA_FETCHED,
|
||||
IMS_SOCKET_ERROR,
|
||||
IMS_RAW_IMPORT_SUCCESSFUL,
|
||||
IMS_RAW_IMPORT_FAILED,
|
||||
} from "../constants/action-types";
|
||||
const initialState = {
|
||||
dataTransferred: false,
|
||||
comicBookMetadata: [],
|
||||
socketConnected: false,
|
||||
rawImportCompleted: {},
|
||||
rawImportDetails: {},
|
||||
rawImportError: {},
|
||||
};
|
||||
|
||||
function fileOpsReducer(state = initialState, action) {
|
||||
@@ -29,7 +31,12 @@ function fileOpsReducer(state = initialState, action) {
|
||||
case IMS_RAW_IMPORT_SUCCESSFUL:
|
||||
return {
|
||||
...state,
|
||||
rawImportCompleted: action.rawImportCompleted,
|
||||
rawImportDetails: action.rawImportDetails,
|
||||
};
|
||||
case IMS_RAW_IMPORT_FAILED:
|
||||
return {
|
||||
...state,
|
||||
rawImportErorr: action.rawImportError,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
|
||||
Reference in New Issue
Block a user