Skip to content

Commit

Permalink
fix: update user returns
Browse files Browse the repository at this point in the history
  • Loading branch information
makinosp committed Jul 28, 2024
1 parent b1cdeae commit 8d33a2a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 1 addition & 3 deletions Sources/VRCKit/PreviewServices/UserPreviewService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ public final class UserPreviewService: UserService {
PreviewDataProvider.shared.userDetails.first { $0.id == userId }!
}

override public func updateUser(id: String, editedInfo: EditableUserInfo) async throws -> User {
PreviewDataProvider.shared.previewUser
}
override public func updateUser(id: String, editedInfo: EditableUserInfo) async throws {}
}
2 changes: 1 addition & 1 deletion Sources/VRCKit/Protocols/UserServiceProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

public protocol UserServiceProtocol {
func fetchUser(userId: String) async throws -> UserDetail
func updateUser(id: String, editedInfo: EditableUserInfo) async throws -> User
func updateUser(id: String, editedInfo: EditableUserInfo) async throws
}
5 changes: 2 additions & 3 deletions Sources/VRCKit/Services/UserService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ public class UserService: APIService, UserServiceProtocol {
}

/// Update user
public func updateUser(id: String, editedInfo: EditableUserInfo) async throws -> User {
public func updateUser(id: String, editedInfo: EditableUserInfo) async throws {
let requestData = try Serializer.shared.encode(editedInfo)
let response = try await client.request(
_ = try await client.request(
path: "\(path)/\(id)",
method: .put,
body: requestData
)
return try Serializer.shared.decode(response.data)
}
}

0 comments on commit 8d33a2a

Please sign in to comment.