diff options
Diffstat (limited to 'shared/src/commonMain')
-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 |