diff options
author | Isidro Henoch <imhenoch@protonmail.com> | 2022-01-15 01:10:32 -0600 |
---|---|---|
committer | Isidro Henoch <imhenoch@protonmail.com> | 2022-01-15 01:10:32 -0600 |
commit | a48d8624d2ee876eac1fed2d0c32af7dccb4a195 (patch) | |
tree | 50c337facc7f2a9aef0ddd08588e167f3d50ebc9 /shared | |
parent | 7e27a317fead5a3bda6608bf63a0e3fdf8093fc4 (diff) | |
download | etbsa-trackermap-mobile-a48d8624d2ee876eac1fed2d0c32af7dccb4a195.tar.gz etbsa-trackermap-mobile-a48d8624d2ee876eac1fed2d0c32af7dccb4a195.tar.bz2 etbsa-trackermap-mobile-a48d8624d2ee876eac1fed2d0c32af7dccb4a195.zip |
Fixes the 401 error while registering the FCM token
Diffstat (limited to 'shared')
-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) { |