From 9bfaa525db29d0f591750582415894ebfeced0f6 Mon Sep 17 00:00:00 2001
From: Alex <alex.tran1502@gmail.com>
Date: Thu, 29 Aug 2024 13:46:47 -0500
Subject: [PATCH] fix(mobile): long waiting time for login request when server
 is unreachable (#12100)

* fix(mobile): long waiting time for login request when server is unreachable

* lint

* increase timeout duration
---
 mobile/lib/providers/authentication.provider.dart | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mobile/lib/providers/authentication.provider.dart b/mobile/lib/providers/authentication.provider.dart
index 5d3ae5bc22..b56e71b11b 100644
--- a/mobile/lib/providers/authentication.provider.dart
+++ b/mobile/lib/providers/authentication.provider.dart
@@ -170,8 +170,10 @@ class AuthenticationNotifier extends StateNotifier<AuthenticationState> {
     UserPreferencesResponseDto? userPreferences;
     try {
       final responses = await Future.wait([
-        _apiService.usersApi.getMyUser(),
-        _apiService.usersApi.getMyPreferences(),
+        _apiService.usersApi.getMyUser().timeout(const Duration(seconds: 7)),
+        _apiService.usersApi
+            .getMyPreferences()
+            .timeout(const Duration(seconds: 7)),
       ]);
       userResponse = responses[0] as UserAdminResponseDto;
       userPreferences = responses[1] as UserPreferencesResponseDto;