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 { NextDispatcher next) async {
final action = dynamicAction as PurgeDataRequest; final action = dynamicAction as PurgeDataRequest;
final state = store.state; final state = store.state;
final company = state.company;
repository repository
.purgeData( .purgeData(
credentials: state.credentials, credentials: state.credentials,
password: action.password, password: action.password,
idToken: action.idToken, idToken: action.idToken,
companyId: state.company.id) companyId: company.id)
.then((dynamic value) { .then((dynamic value) {
store.dispatch(PurgeDataSuccess()); store.dispatch(PurgeDataSuccess());
store.dispatch(RefreshData( store.dispatch(RefreshData(

View File

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