This commit is contained in:
2024-08-11 21:17:02 +08:00
parent 19527f17c3
commit 322a4320c7
9 changed files with 160 additions and 31 deletions

View File

@@ -1,6 +1,7 @@
package com.aiosman.riderpro.data.api
import com.aiosman.riderpro.AppStore
import com.aiosman.riderpro.ConstVars
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.Response
@@ -16,7 +17,7 @@ class AuthInterceptor() : Interceptor {
}
object ApiClient {
const val BASE_SERVER = "http://192.168.31.57:8088"
const val BASE_SERVER = ConstVars.BASE_SERVER
const val BASE_API_URL = "${BASE_SERVER}/api/v1"
const val RETROFIT_URL = "${BASE_API_URL}/"
private val okHttpClient: OkHttpClient by lazy {

View File

@@ -13,6 +13,7 @@ import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Multipart
import retrofit2.http.PATCH
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Path
@@ -128,6 +129,13 @@ interface RiderProAPI {
@GET("account/my")
suspend fun getMyAccount(): Response<DataContainer<AccountProfile>>
@Multipart
@PATCH("account/my/profile")
suspend fun updateProfile(
@Part avatar: MultipartBody.Part?,
@Part("nickname") nickname: RequestBody?,
): Response<Unit>
@GET("profile/{id}")
suspend fun getAccountProfileById(
@Path("id") id: Int