|
|
|
|
@ -24,6 +24,9 @@ struct UserCreationView: View { |
|
|
|
|
|
|
|
|
|
let countries: [String] = Locale.countries() |
|
|
|
|
|
|
|
|
|
@State var isLoading = false |
|
|
|
|
@State var showLoginScreen: Bool = false |
|
|
|
|
|
|
|
|
|
var body: some View { |
|
|
|
|
|
|
|
|
|
Form { |
|
|
|
|
@ -63,7 +66,11 @@ struct UserCreationView: View { |
|
|
|
|
Button(action: { |
|
|
|
|
self._create() |
|
|
|
|
}, label: { |
|
|
|
|
Text("Create") |
|
|
|
|
if self.isLoading { |
|
|
|
|
ProgressView() |
|
|
|
|
} else { |
|
|
|
|
Text("Create") |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.frame(maxWidth: .infinity) |
|
|
|
|
} |
|
|
|
|
@ -95,6 +102,9 @@ struct UserCreationView: View { |
|
|
|
|
guard let service = Store.main.service else { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
self.isLoading = true |
|
|
|
|
|
|
|
|
|
Task { |
|
|
|
|
do { |
|
|
|
|
let userCreationForm = UserCreationForm( |
|
|
|
|
@ -108,15 +118,15 @@ struct UserCreationView: View { |
|
|
|
|
|
|
|
|
|
let _: User = try await service.createAccount(user: userCreationForm) |
|
|
|
|
|
|
|
|
|
// let _ = try await service.requestToken(username: self.username, password: self.password1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch { |
|
|
|
|
self.isLoading = false |
|
|
|
|
Logger.error(error) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|