Skip to content

Commit

Permalink
feat(#174): LogoutEventRepository, LogoutEvent ์ƒ์„ฑ
Browse files Browse the repository at this point in the history
  • Loading branch information
yang1318 committed Dec 6, 2023
1 parent e61f3d2 commit ecaea54
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package boostcamp.and07.mindsync.data.repository.login

import android.util.Log
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class LogoutEventRepository
@Inject
constructor(
private val tokenRepository: TokenRepository,
) {
private val _logoutEvent = MutableSharedFlow<LogoutEvent>()
val logoutEvent = _logoutEvent.asSharedFlow()

suspend fun logoutRequest() {
Log.d("LogoutEventRepository", "logoutRequest: ์„ฑ๊ณต!!")
_logoutEvent.emit(LogoutEvent.Logout)
tokenRepository.deleteAccessToken()
tokenRepository.deleteRefreshToken()
}
}

sealed interface LogoutEvent {
data object Logout : LogoutEvent
}

0 comments on commit ecaea54

Please sign in to comment.