diff --git a/app/src/main/java/org/android/go/sopt/present/viewModel/LoginViewModel.kt b/app/src/main/java/org/android/go/sopt/present/viewModel/LoginViewModel.kt deleted file mode 100644 index 9f83487..0000000 --- a/app/src/main/java/org/android/go/sopt/present/viewModel/LoginViewModel.kt +++ /dev/null @@ -1,94 +0,0 @@ -package org.android.go.sopt.present.viewModel - -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.ViewModel -import org.android.go.sopt.RequestSignUpDto -import org.android.go.sopt.ResponseSignUpDto -import org.android.go.sopt.remote.ServicePool -import org.android.go.sopt.remote.remoteData.model.MyProfileDto -import org.android.go.sopt.remote.remoteData.model.RequestLogInDto -import org.android.go.sopt.remote.remoteData.model.ResponseLogInDto -import retrofit2.Call -import retrofit2.Callback -import retrofit2.Response - - -class LoginViewModel:ViewModel() { - private val loginService = ServicePool.loginPageService - - - private val _loginResult = MutableLiveData() - val loginResult :LiveData get() = _loginResult - - private val _signUpResult = MutableLiveData() - val signUpResult:LiveData get() = _signUpResult - - private val _myProfile = MutableLiveData() - val myProfile:LiveData get() = _myProfile - - - fun login(id: String, password: String) { - loginService.login( - RequestLogInDto( - id, - password - ) - ).enqueue(object : Callback { - override fun onResponse( - call: Call, - response: Response, - ) { - if (response.isSuccessful) { - _loginResult.value = response.body() - - - - } else { - - } - } - - override fun onFailure(call: Call, t: Throwable) { - - } - }) - } - - fun signUp(id:String, password:String, name:String, skill:String){ - loginService.signUp(RequestSignUpDto(id,password,name,skill)).enqueue(object : Callback{ - override fun onResponse( - call: Call, - response: Response - ) { - if(response.isSuccessful){ - _signUpResult.value = response.body() - } - } - - override fun onFailure(call: Call, t: Throwable) { - - } - - - }) - } - - fun myProfile(userId:String){ - loginService.myProfile(userId).enqueue(object:Callback{ - override fun onResponse(call: Call, response: Response) { - if(response.isSuccessful){ - _myProfile.value = response.body() - } - } - - override fun onFailure(call: Call, t: Throwable) { - } - - }) - } - - - - -} \ No newline at end of file