gastsail / CocktailApp

Cocktails Android App with Clean Architecture, MVVM , Retrofit, Coroutines, Navigation Components , Room, Dagger Hilt, Cache Strategy and Coroutines Flow
MIT License
446 stars 77 forks source link

[Question] How about the login flow? #6

Closed dphans closed 3 years ago

dphans commented 3 years ago

Can I ask a question about authentication, aka. login flow?

And second question, I heard about recommend that ViewModel will never access to repositories directly, it will call to repositories by usecases (aka. interactors), how about you?

gastsail commented 3 years ago

in this repo viewmodel is calling the interceptor (repo interface) that is the abstraction of the repo logic, we are not calling directly to the repo, about login flow you are correct, make sure to check for the token each time you do a call, if needs to be refreshed you can call refresh token from the api