Skip to content

Commit

Permalink
fix(auth): adds missing redirectTo query item to updateUser (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
leoMehlig committed May 13, 2024
1 parent 6d4ac07 commit 5d1a997
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sources/Auth/AuthClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ public final class AuthClient: Sendable {

/// Updates user data, if there is a logged in user.
@discardableResult
public func update(user: UserAttributes) async throws -> User {
public func update(user: UserAttributes, redirectTo: URL? = nil) async throws -> User {
var user = user

if user.email != nil {
Expand All @@ -935,6 +935,12 @@ public final class AuthClient: Sendable {
.init(
url: configuration.url.appendingPathComponent("user"),
method: .put,
query: [
(redirectTo ?? configuration.redirectToURL).map { URLQueryItem(
name: "redirect_to",
value: $0.absoluteString
) },
].compactMap { $0 },
body: configuration.encoder.encode(user)
)
).decoded(as: User.self, decoder: configuration.decoder)
Expand Down

0 comments on commit 5d1a997

Please sign in to comment.