feat: add AuthRepository for login functionality
This commit is contained in:
parent
9b243b34f2
commit
8e5e73bdf0
|
|
@ -0,0 +1,16 @@
|
|||
package com.syaroful.agrilinkvocpro.data.repository
|
||||
|
||||
import com.syaroful.agrilinkvocpro.data.model.LoginResponse
|
||||
import com.syaroful.agrilinkvocpro.data.network.ApiService
|
||||
import com.syaroful.agrilinkvocpro.data.network.LoginRequest
|
||||
import retrofit2.Response
|
||||
|
||||
class AuthRepository(
|
||||
private val apiService: ApiService
|
||||
){
|
||||
suspend fun login(username: String, password: String): Response<LoginResponse> {
|
||||
val credential = okhttp3.Credentials.basic(username, password)
|
||||
val requestBody = LoginRequest(username, password)
|
||||
return apiService.login(credential, requestBody)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user