Correct deleting primary company
This commit is contained in:
parent
838c592737
commit
30c4e6ab3e
|
|
@ -213,9 +213,14 @@ Middleware<AppState> _createRefreshRequest(AuthRepository repository) {
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
final url =
|
final url =
|
||||||
formatApiUrl(prefs.getString(kSharedPrefUrl) ?? state.authState.url);
|
formatApiUrl(prefs.getString(kSharedPrefUrl) ?? state.authState.url);
|
||||||
final token =
|
|
||||||
TokenEntity.unobscureToken(prefs.getString(kSharedPrefToken)) ??
|
String token;
|
||||||
'TOKEN';
|
if ((state?.userCompany?.token?.token ?? '').isNotEmpty) {
|
||||||
|
token = state.userCompany.token.token;
|
||||||
|
} else {
|
||||||
|
token = TokenEntity.unobscureToken(prefs.getString(kSharedPrefToken)) ??
|
||||||
|
'TOKEN';
|
||||||
|
}
|
||||||
|
|
||||||
final updatedAt = action.clearData && !company.isLarge
|
final updatedAt = action.clearData && !company.isLarge
|
||||||
? 0
|
? 0
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,9 @@ class AccountManagementVM {
|
||||||
GoogleOAuth.disconnect();
|
GoogleOAuth.disconnect();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
store.dispatch(SelectCompany(companyIndex: 0));
|
final selectedCompanyIndex = state.uiState.selectedCompanyIndex;
|
||||||
|
final index = selectedCompanyIndex == 0 ? 1 : 0;
|
||||||
|
store.dispatch(SelectCompany(companyIndex: index));
|
||||||
final refreshCompleter = Completer<Null>()
|
final refreshCompleter = Completer<Null>()
|
||||||
..future.then((value) {
|
..future.then((value) {
|
||||||
store.dispatch(SelectCompany(companyIndex: 0));
|
store.dispatch(SelectCompany(companyIndex: 0));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue