Ваша проблема в том, что FileReader API является асинхронным.Вам нужно заблокировать свой код и подождать, пока чтение файла не будет завершено.
Попробуйте использовать что-то подобное ... см. Ниже.
ПРИМЕЧАНИЕ. Я предполагаю, что остальная часть вашего кода правильная, поэтомутолько что скопировал.
@Effect()
uploadChange$: Observable<Action> = this.actions$.pipe(
ofType(OurActionTypes.UploadChange),
// map(action => action['payload'])
map(action => {
// console.log(action['payload']);
var input = action['payload'];
// this await should wait until the promise completes
let result = await new Promise((resolve) => {
// this is your file reader - asynchronous call
const fileReader = new FileReader();
fileReader.onload = (e) => {
const raw = (<FileReader>e.target).result as string;
const res = JSON.parse(raw);
console.log(res);
// this is a call back to the promise
resolve(res);
};
fileReader.readAsText(input);
});
// this is the result of the map function
return result;
}),
map((res) => new OurActions.UploadComplete(res))
);