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
public typealias LoginSuccessClosure = (Account, User) -> Void
public typealias AuthenticatedClosure = (Account, User) -> Void

View File

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

View File

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