KotlinLeaner
03/07/2025, 6:25 PMmarlonlom
03/08/2025, 6:37 PMVivek Modi
03/09/2025, 6:20 PMeyedol
03/09/2025, 7:00 PMViewModel
or where ever you're calling a function to make a network call that will cause the 401
, you could catch the exception that would be thrown and then check to make sure it's an exception due to a 401
then react to it by sending an event or UI state to the UI to cause a logout or directly logout from there – where you are catching the 401
error. See this sample implementation in the Tivi app for an example: https://github.com/chrisbanes/tivi/blob/main/ui/root/src/commonMain/kotlin/app/tivi/home/RootViewModel.kt#L50KotlinLeaner
03/09/2025, 11:10 PMAhmet Özcan
03/10/2025, 5:52 PM