diff options
Diffstat (limited to 'shared/src/commonMain/kotlin/mx/trackermap')
-rw-r--r-- | shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/SessionApi.kt | 1 | ||||
-rw-r--r-- | shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/SessionController.kt | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/SessionApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/SessionApi.kt index 2fba8a8..b57f126 100644 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/SessionApi.kt +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/SessionApi.kt @@ -107,6 +107,7 @@ class SessionApi(basePath: String = "https://demo.traccar.org/api") : ApiClient( .flatten() .find { it.contains("JSESSIONID") }!! .replace("; Path=/", "") + this.token = cookie val settings = Settings() settings.putString(ACCESS_TOKEN_KEY, cookie) (response as Success<*>).data as User diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/SessionController.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/SessionController.kt index b9cf335..da9b115 100644 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/SessionController.kt +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/SessionController.kt @@ -73,9 +73,9 @@ class SessionController( loginStateFlow.value = LoginState.Loading GlobalScope.launch { try { - userFlow.value = sessionApi.sessionPost(email, password) - delay(3000) - Log.d("LoginViewModel", userFlow.value.toString()) + val session = sessionApi.sessionPost(email, password) + userFlow.value = session + usersApi.token = sessionApi.token token?.let { registerFcmToken(it) } loginStateFlow.value = LoginState.Success } catch (e: Exception) { |