Sean Keane
04/16/2020, 8:51 AM//JS LAYER
@ExperimentalJsExport
@JsExport
fun authService() : AuthService = CoreAPI.authService
Inside the function it calls a Object singleton to return the auth service
// COMMON LAYER
object CoreAPI : CoreAPIService {
override val authService: AuthService = KAuthService(storage)
}
The implementation of the Auth service is the following interface
//COMMON LAYER
class KAuthService(
storage: Storage,
private val credentialsManager: CredentialsManager = KCredentialsManager(storage)
) : AuthService {
override fun login(
loginRequest: LoginRequest,
onSuccess: (Unit) -> Unit,
onError: (KError) -> Unit
) {
LoginInteractor(loginRequest, onSuccess, onError, credentialsManager = credentialsManager).execute()
}
}
interface AuthService {
fun login(loginRequest: LoginRequest,
onSuccess: (Unit) -> Unit,
onError: (KError) -> Unit)
}
Where its odd is trying to access it in JS doesnt show the login method. Or even contain it in the compiled code? Im a little lost as I can make it work with direct classes. I think its an interface issue but not too sure?