refs class Interceptor

This commit is contained in:
Sergio De la torre 2023-04-11 14:42:04 +02:00
parent 17b6b6d577
commit 0f8c698f8b
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
package verdnatura.es.repartoverdnatura.UTILS
import android.content.Context
import okhttp3.Interceptor
import okhttp3.Response
import java.io.IOException
class SilexInterceptor : Interceptor {
private var context: Context
constructor(context: Context) {
this.context = context
}
@Throws(IOException::class)
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()
val newRequest = request.newBuilder()
.addHeader("Authorization", Utils.getTokenUser(context))
.build()
return chain.proceed(newRequest)
}
}