From 0a926b76ddae080fd5df155503c118074679605d Mon Sep 17 00:00:00 2001 From: Laurent Date: Fri, 19 Jul 2024 14:38:16 +0200 Subject: [PATCH] Fix logout service --- LeStorage/Services.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/LeStorage/Services.swift b/LeStorage/Services.swift index dd27375..660a280 100644 --- a/LeStorage/Services.swift +++ b/LeStorage/Services.swift @@ -59,6 +59,7 @@ public class Services { self.keychainStore = KeychainStore(serverId: url) // self._storeIdentifier = storeId Logger.log("create keystore with id: \(url)") + } /// The base API URL to send requests @@ -340,8 +341,8 @@ public class Services { /// - username: the account's username /// - password: the account's password public func logout() async throws { - let logoutRequest = try self._baseRequest(conf: .logout) - let _: Empty = try await self._runRequest(logoutRequest) + let deviceId: String = StoreCenter.main.deviceId() + let _: Empty = try await self._runRequest(serviceConf: .logout, payload: Logout(deviceId: deviceId)) } /// A login method that actually requests a token from the server, and stores the appropriate data for later usage @@ -456,6 +457,9 @@ struct Email: Codable { } struct Empty: Codable { +} +struct Logout: Codable { + var deviceId: String } struct DeviceToken: Codable { var value: String