Skip to content

Commit

Permalink
[Feat/#53] 설정 로그아웃 mvvm 로직 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
ss99x2002 committed Jul 13, 2023
1 parent 4182284 commit 0f2655f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ package com.sopt.umbba_android.presentation.setting
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.activity.viewModels
import androidx.fragment.app.viewModels
import com.sopt.umbba_android.R
import com.sopt.umbba_android.databinding.ActivityManageAccountBinding
import com.sopt.umbba_android.util.binding.BindingActivity

class ManageAccountActivity :
BindingActivity<ActivityManageAccountBinding>(R.layout.activity_manage_account),
View.OnClickListener {
private val manageAccountViewModel by viewModels<ManageAccountViewModel>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding.clickListener = this
Expand All @@ -25,7 +28,7 @@ class ManageAccountActivity :
private fun setClickEvent() {
with(binding) {
clLogout.setOnClickListener {
TODO("서버 로그아웃 API 연결")
manageAccountViewModel.logout()
}
clDeleteAccount.setOnClickListener {
startActivity(Intent(this@ManageAccountActivity, DeleteAccountActivity::class.java))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.sopt.umbba_android.presentation.setting

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.sopt.umbba_android.data.repository.SettingRepositoryImpl
import kotlinx.coroutines.launch

class ManageAccountViewModel(private val settingRepositoryImpl: SettingRepositoryImpl) :
ViewModel() {
fun logout() {
viewModelScope.launch {
settingRepositoryImpl.logout()
}
}
}

0 comments on commit 0f2655f

Please sign in to comment.