diff options
author | Isidro Henoch <imhenoch@protonmail.com> | 2022-01-12 18:10:01 -0600 |
---|---|---|
committer | Isidro Henoch <imhenoch@protonmail.com> | 2022-01-12 18:10:01 -0600 |
commit | 9a125dd2ca5144ae49761b73564871bb0b38c0b7 (patch) | |
tree | 2f64529e1be83c896a47774876ea1bd514f1c719 /shared/src/commonMain/kotlin/mx/trackermap | |
parent | b9a9eeeb9f104b6fe11a5bc523cad189b293160c (diff) | |
parent | 270e54f2d83a962a33646c47917d8ea00a282bd9 (diff) | |
download | etbsa-trackermap-mobile-9a125dd2ca5144ae49761b73564871bb0b38c0b7.tar.gz etbsa-trackermap-mobile-9a125dd2ca5144ae49761b73564871bb0b38c0b7.tar.bz2 etbsa-trackermap-mobile-9a125dd2ca5144ae49761b73564871bb0b38c0b7.zip |
Merge branch 'user_information'
Diffstat (limited to 'shared/src/commonMain/kotlin/mx/trackermap')
-rw-r--r-- | shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/SessionApi.kt | 13 |
1 files changed, 8 insertions, 5 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 4344de0..417a818 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 @@ -25,7 +25,6 @@ class SessionApi(basePath: kotlin.String = "https://demo.traccar.org/api") : Api * @return void */ suspend fun sessionDelete(): Unit { - val localVariableConfig = RequestConfig( RequestMethod.DELETE, "/session" @@ -35,7 +34,10 @@ class SessionApi(basePath: kotlin.String = "https://demo.traccar.org/api") : Api ) return when (response.responseType) { - ResponseType.Success -> Unit + ResponseType.Success -> { + val settings = Settings() + settings.remove(ACCESS_TOKEN_KEY) + } ResponseType.Informational -> TODO() ResponseType.Redirection -> TODO() ResponseType.ClientError -> throw ClientException( @@ -54,11 +56,12 @@ class SessionApi(basePath: kotlin.String = "https://demo.traccar.org/api") : Api * @return User */ @Suppress("UNCHECKED_CAST") - suspend fun sessionGet(token: kotlin.String? = null): User { - val localVariableQuery: MultiValueMap = mapOf("token" to listOf("$token")) + suspend fun sessionGet(token: String? = null): User { + val query: MutableMap<String, List<String>> = mutableMapOf() + token?.let { query["userId"] = listOf(it) } val localVariableConfig = RequestConfig( RequestMethod.GET, - "/session", query = localVariableQuery + "/session", query = query ) val response = request<User>( localVariableConfig |