-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#174): LogoutEventRepository, LogoutEvent ์์ฑ
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...app/src/main/java/boostcamp/and07/mindsync/data/repository/login/LogoutEventRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |