Skip to content

Commit

Permalink
fix: 임시 비밀번호 전송시 Toast 메시지 추가 (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwahk committed Dec 10, 2024
1 parent 901df6c commit cd4d790
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.example.mhnfe.ui.screens.auth.login

import android.content.Context
import android.content.SharedPreferences
import android.util.Log
import android.widget.Toast
import androidx.datastore.core.DataStore
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
Expand All @@ -14,6 +16,7 @@ import com.example.mhnfe.data.remote.response.RefreshToken
import com.example.mhnfe.data.remote.response.SendPasswordResponse
import com.example.mhnfe.data.repository.AuthRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.first
Expand All @@ -30,7 +33,8 @@ class LoginViewModel @Inject constructor(
private val refreshTokenDataStore: DataStore<RefreshToken>,
private val groupIdDataStore: DataStore<GroupId>,
private val memberIdDataStore: DataStore<MemberId>,
private val sharedPreferences: SharedPreferences
private val sharedPreferences: SharedPreferences,
@ApplicationContext private val context: Context
) : ViewModel() {

// 로그인 결과 상태
Expand Down Expand Up @@ -187,6 +191,7 @@ class LoginViewModel @Inject constructor(
if(response.result.code == 200) {
_sendPasswordResponse.value = response
_errorMessage.value = null
Toast.makeText(context, "임시 비밀번호가 메일로 전송되었습니다.", Toast.LENGTH_SHORT).show()
} else {
_errorMessage.value = mapErrorMessage(
response.result.code,
Expand Down

0 comments on commit cd4d790

Please sign in to comment.