You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
38 lines
1.2 KiB
package com.community.pocket.data.register;
|
|
|
|
import androidx.lifecycle.MutableLiveData;
|
|
|
|
import com.community.pocket.ui.register.RegisterResponse;
|
|
import com.community.pocket.util.HttpRequest;
|
|
import com.community.pocket.util.HttpUtil;
|
|
import com.community.pocket.util.SimpleHttpParse;
|
|
|
|
import okhttp3.FormBody;
|
|
|
|
/**
|
|
* 该类请求注册接口完成注册操作
|
|
*/
|
|
public class RegisterRequest {
|
|
private static volatile RegisterRequest instance;
|
|
|
|
private RegisterRequest() {
|
|
}
|
|
|
|
public static RegisterRequest getInstance() {
|
|
if (instance == null) {
|
|
instance = new RegisterRequest();
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
@HttpRequest("/register")
|
|
public void register(MutableLiveData<RegisterResponse> liveData, String username, String password, String mobilePhone, String email) {
|
|
HttpUtil.getRequest(HttpUtil.Method.POST, new SimpleHttpParse<RegisterResponse>(liveData).getInterface(RegisterResponse.class),
|
|
new FormBody.Builder()
|
|
.add("username", username)
|
|
.add("password", password)
|
|
.add("mobilePhone", mobilePhone)
|
|
.add("email", email)
|
|
.build());
|
|
}
|
|
}
|
|
|