Files
Gas-Tank-AR-App/GasTankAR/Services/StubAuthenticationService.swift

22 lines
681 B
Swift

import Foundation
struct StubAuthenticationService: AuthenticationService {
let simulatedError: LoginError?
let delay: Duration
init(simulatedError: LoginError? = nil, delay: Duration = .milliseconds(600)) {
self.simulatedError = simulatedError
self.delay = delay
}
func signIn(salesCode: String) async throws -> LoginSession {
try await Task.sleep(for: delay)
try Task.checkCancellation()
if let simulatedError {
throw simulatedError
}
// Demo employee until the authentication API supplies the profile.
return LoginSession(salesCode: salesCode, displayName: "M. Krämer")
}
}