Clear AP history when purging data

This commit is contained in:
Hillel Coren 2022-08-01 16:02:38 +03:00
parent 2def694c7d
commit 0fdd21fa86
2 changed files with 6 additions and 1 deletions

View File

@ -441,13 +441,14 @@ Middleware<AppState> _purgeData(AuthRepository repository) {
NextDispatcher next) async {
final action = dynamicAction as PurgeDataRequest;
final state = store.state;
final company = state.company;
repository
.purgeData(
credentials: state.credentials,
password: action.password,
idToken: action.idToken,
companyId: state.company.id)
companyId: company.id)
.then((dynamic value) {
store.dispatch(PurgeDataSuccess());
store.dispatch(RefreshData(

View File

@ -435,6 +435,10 @@ CompanyPrefState companyPrefReducer(CompanyPrefState state, dynamic action) {
}
Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
TypedReducer<BuiltList<HistoryRecord>, PurgeDataSuccess>(
(historyList, action) {
return BuiltList<HistoryRecord>();
}),
TypedReducer<BuiltList<HistoryRecord>, PopLastHistory>(
(historyList, action) {
if (historyList.isEmpty) {