feat: implement register functionality in ApiService
This commit is contained in:
parent
eed504f04e
commit
35a5e7a016
|
|
@ -3,6 +3,7 @@ package com.syaroful.agrilinkvocpro.data.network
|
|||
import com.syaroful.agrilinkvocpro.data.model.DhtGraphicDataResponse
|
||||
import com.syaroful.agrilinkvocpro.data.model.LoginResponse
|
||||
import com.syaroful.agrilinkvocpro.data.model.NpkGraphicDataResponse
|
||||
import com.syaroful.agrilinkvocpro.data.model.RegisterResponse
|
||||
import com.syaroful.agrilinkvocpro.data.model.SensorDataResponse
|
||||
import retrofit2.Response
|
||||
import retrofit2.http.Body
|
||||
|
|
@ -18,6 +19,13 @@ data class LoginRequest(
|
|||
val remember_me: Boolean = true
|
||||
)
|
||||
|
||||
data class RegisterRequest(
|
||||
val username: String,
|
||||
val password: String,
|
||||
val email: String,
|
||||
val fullname: String
|
||||
)
|
||||
|
||||
interface ApiService {
|
||||
@POST("auth/login")
|
||||
suspend fun login(
|
||||
|
|
@ -25,6 +33,11 @@ interface ApiService {
|
|||
@Body body: LoginRequest,
|
||||
): Response<LoginResponse>
|
||||
|
||||
@POST("auth/register")
|
||||
suspend fun register(
|
||||
@Body body: RegisterRequest,
|
||||
): Response<RegisterResponse>
|
||||
|
||||
@GET("api/sensor-readings/latest")
|
||||
suspend fun getLatestSensorData(
|
||||
@Header("Authorization") authHeader: String
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user