mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-06-13 13:39:23 -04:00
Add direct OFX imports
This commit is contained in:
47
js/reducers/ImportReducer.js
Normal file
47
js/reducers/ImportReducer.js
Normal file
@ -0,0 +1,47 @@
|
||||
var assign = require('object-assign');
|
||||
|
||||
var ImportConstants = require('../constants/ImportConstants');
|
||||
var UserConstants = require('../constants/UserConstants');
|
||||
|
||||
const initialState = {
|
||||
showModal: false,
|
||||
importing: false,
|
||||
uploadProgress: 0,
|
||||
importFinished: false,
|
||||
importFailed: false,
|
||||
errorMessage: null
|
||||
};
|
||||
|
||||
module.exports = function(state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case ImportConstants.OPEN_IMPORT_MODAL:
|
||||
return assign({}, initialState, {
|
||||
showModal: true
|
||||
});
|
||||
case ImportConstants.CLOSE_IMPORT_MODAL:
|
||||
case UserConstants.USER_LOGGEDOUT:
|
||||
return initialState;
|
||||
case ImportConstants.BEGIN_IMPORT:
|
||||
return assign({}, state, {
|
||||
importing: true
|
||||
});
|
||||
case ImportConstants.UPDATE_IMPORT_PROGRESS:
|
||||
return assign({}, state, {
|
||||
uploadProgress: action.progress
|
||||
});
|
||||
case ImportConstants.IMPORT_FINISHED:
|
||||
return assign({}, state, {
|
||||
importing: false,
|
||||
uploadProgress: 100,
|
||||
importFinished: true
|
||||
});
|
||||
case ImportConstants.IMPORT_FAILED:
|
||||
return assign({}, state, {
|
||||
importing: false,
|
||||
importFailed: true,
|
||||
errorMessage: action.error
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
@ -11,6 +11,7 @@ var ReportReducer = require('./ReportReducer');
|
||||
var SelectedReportReducer = require('./SelectedReportReducer');
|
||||
var TransactionReducer = require('./TransactionReducer');
|
||||
var TransactionPageReducer = require('./TransactionPageReducer');
|
||||
var ImportReducer = require('./ImportReducer');
|
||||
var ErrorReducer = require('./ErrorReducer');
|
||||
|
||||
module.exports = Redux.combineReducers({
|
||||
@ -25,5 +26,6 @@ module.exports = Redux.combineReducers({
|
||||
selectedReport: SelectedReportReducer,
|
||||
transactions: TransactionReducer,
|
||||
transactionPage: TransactionPageReducer,
|
||||
imports: ImportReducer,
|
||||
error: ErrorReducer
|
||||
});
|
||||
|
Reference in New Issue
Block a user