package com.ys.bdtp.adm.app.interceptor

import android.content.SharedPreferences
import com.ys.bdtp.adm.app.Token
import okhttp3.Interceptor
import okhttp3.Response

/**
 * token 拦截器
 *
 * @author bai
 */
class TokenInterceptor(private val sp: SharedPreferences) : Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val originalRequest = chain.request()
        val quest = originalRequest.newBuilder()
            .header("token", sp.getString(Token, "")!!)
            .build()
        return chain.proceed(quest)
    }
}