@@ -6,6 +6,7 @@ import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFact
66import com.kuit.findu.BuildConfig
77import com.kuit.findu.BuildConfig.DEBUG
88import com.kuit.findu.data.datalocal.datasource.TokenLocalDataSource
9+ import com.kuit.findu.data.dataremote.util.AuthAuthenticator
910import com.kuit.findu.data.dataremote.util.AuthInterceptor
1011import com.kuit.findu.data.dataremote.util.ErrorTrackingInterceptor
1112import dagger.Module
@@ -42,15 +43,17 @@ object NetworkModule {
4243 fun providesOkHttpClient (
4344 loggingInterceptor : HttpLoggingInterceptor ,
4445 authInterceptor : AuthInterceptor ,
46+ authAuthenticator : AuthAuthenticator ,
4547 errorTrackingInterceptor : ErrorTrackingInterceptor ,
4648 ): OkHttpClient =
4749 OkHttpClient .Builder ().apply {
4850 connectTimeout(10 , TimeUnit .SECONDS )
4951 writeTimeout(10 , TimeUnit .SECONDS )
5052 readTimeout(10 , TimeUnit .SECONDS )
53+ addInterceptor(authInterceptor)
5154 if (DEBUG ) addInterceptor(loggingInterceptor)
5255 else addInterceptor(errorTrackingInterceptor)
53- addInterceptor(authInterceptor )
56+ addInterceptor(authAuthenticator )
5457 }.build()
5558
5659 @Provides
@@ -69,6 +72,15 @@ object NetworkModule {
6972 return AuthInterceptor (tokenLocalDataSource, context)
7073 }
7174
75+ @Provides
76+ @Singleton
77+ fun provideAuthAuthenticator (
78+ tokenLocalDataSource : TokenLocalDataSource ,
79+ @ApplicationContext context : Context ,
80+ ): AuthAuthenticator {
81+ return AuthAuthenticator (tokenLocalDataSource, context)
82+ }
83+
7284 @Provides
7385 @Singleton
7486 fun provideErrorTrackingInterceptor (
0 commit comments