preliminary auto-login

This commit is contained in:
shenlong-tanwen
2024-09-14 23:05:58 +05:30
parent 6fce1ebb79
commit f1dcfbc594
13 changed files with 193 additions and 63 deletions
@@ -9,13 +9,19 @@ class UserService with LogContext {
Future<User?> getMyUser() async {
try {
final userDto = await _userApi.getMyUser();
final [
userDto as UserAdminResponseDto?,
preferencesDto as UserPreferencesResponseDto?
] = await Future.wait([
_userApi.getMyUser(),
_userApi.getMyPreferences(),
]);
if (userDto == null) {
log.severe("Cannot fetch my user.");
return null;
}
final preferencesDto = await _userApi.getMyPreferences();
return User.fromAdminDto(userDto, preferencesDto);
} catch (e, s) {
log.severe("Error while fetching my user", e, s);