invoice/lib/redux/app/loading_reducer.dart

32 lines
707 B
Dart

// Package imports:
import 'package:redux/redux.dart';
// Project imports:
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
final loadingReducer = combineReducers<bool>([
TypedReducer<bool, StartLoading>(_setLoading),
TypedReducer<bool, StopLoading>(_setLoaded),
]);
bool _setLoading(bool state, StartLoading action) {
return true;
}
bool _setLoaded(bool state, StopLoading action) {
return false;
}
final savingReducer = combineReducers<bool>([
TypedReducer<bool, StartSaving>(_setSaving),
TypedReducer<bool, StopSaving>(_setSaved),
]);
bool _setSaving(bool state, StartSaving action) {
return true;
}
bool _setSaved(bool state, StopSaving action) {
return false;
}