import { Zondy } from '../../base'
import { defaultValue } from '../../util'
/**
* 请求拦截和相应拦截器参数
* @class Interceptor
* @moduleEx ServiceModule
* @param {Object} options 构造参数
* @param {Array | String} [options.urls = []] 本次拦截会影像的链接,只要链接包含urls的值,就会被影响,可以设置为字符串或数组,如果未设置值,则会影响全部请求
* @param {Function} [options.before = null] 请求发送前响应的函数
* @param {Function} [options.after = null] 请求发送完成后响应的函数
* */
class Interceptor {
constructor(options) {
this.urls = defaultValue(options.urls, [])
this.before = defaultValue(options.before, undefined)
this.after = defaultValue(options.urls, undefined)
}
}
Zondy.Service.Interceptor = Interceptor
export default Interceptor