Renamed the LoginSuccessClosure closure as AuthenticatedClosure.

This commit is contained in:
Javier Cicchelli 2022-12-12 01:30:49 +01:00
parent 1ef3ec6d87
commit 71871c6ae0
3 changed files with 12 additions and 10 deletions

View File

@ -8,4 +8,4 @@
import DataModels import DataModels
public typealias LoginSuccessClosure = (Account, User) -> Void public typealias AuthenticatedClosure = (Account, User) -> Void

View File

@ -18,7 +18,7 @@ struct GetUserUseCase {
// MARK: Properties // MARK: Properties
let success: LoginSuccessClosure let authenticated: AuthenticatedClosure
// MARK: Functions // MARK: Functions
@ -33,7 +33,7 @@ struct GetUserUseCase {
) )
) )
success( authenticated(
.init( .init(
username: username, username: username,
password: password password: password

View File

@ -17,12 +17,12 @@ public struct LoginView: View {
// MARK: Properties // MARK: Properties
private let success: LoginSuccessClosure private let authenticated: AuthenticatedClosure
// MARK: Initialisers // MARK: Initialisers
public init(success: @escaping LoginSuccessClosure) { public init(authenticated: @escaping AuthenticatedClosure) {
self.success = success self.authenticated = authenticated
} }
// MARK: Body // MARK: Body
@ -32,7 +32,7 @@ public struct LoginView: View {
.vertical, .vertical,
showsIndicators: false showsIndicators: false
) { ) {
LoginContainer(success: success) LoginContainer(authenticated: authenticated)
.padding(.horizontal, 24) .padding(.horizontal, 24)
.padding(.top, containerTopPadding) .padding(.top, containerTopPadding)
} }
@ -64,8 +64,8 @@ fileprivate extension LoginView {
// MARK: Initialisers // MARK: Initialisers
init(success: @escaping LoginSuccessClosure) { init(authenticated: @escaping AuthenticatedClosure) {
self.getUser = .init(success: success) self.getUser = .init(authenticated: authenticated)
} }
// MARK: Body // MARK: Body
@ -157,6 +157,8 @@ private extension LoginView.LoginContainer {
struct LoginView_Previews: PreviewProvider { struct LoginView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
LoginView { _, _ in } LoginView { _, _ in
// closure for authenticated action.
}
} }
} }