 import RxCocoa
 
 class PaginationViewModel<Element: Decodable, Filter: FilterType where Element.DecodedType == Element> {
-    
+
     var paginationRequest: PaginationRequest<Element, Filter>
     typealias LoadingType = (Bool, String)
-    
+
     let refreshTrigger = PublishSubject<Bool>()
     let loadNextPageTrigger = PublishSubject<Void>()
     let queryTrigger = PublishSubject<String>()
     let filterTrigger = PublishSubject<Filter>()
-
+    let networkErrorTrigger = PublishSubject<NetworkError>()
     let hasNextPage = Variable<Bool>(false)
     let fullloading = Variable<LoadingType>((false, "1"))
     let elements = Variable<[Element]>([])
-    
+
     private var disposeBag = DisposeBag()
     private let queryDisposeBag = DisposeBag()
-    
+
     init(route: RequestType, page: String = "1", query: String = "", filter: Filter? = nil) {
         paginationRequest = PaginationRequest(route: route, page: page, query: query, filter: filter)
         bindPaginationRequest(paginationRequest, nextPage: nil)
         setUpForceRefresh()
     }
-    
+
     private func setUpForceRefresh() {
-        
+
         queryTrigger.skip(1)
             .throttle(0.25, scheduler: MainScheduler.instance)
             .distinctUntilChanged()

            .filter { !$0 }
            .take(1)
            .map { _ in paginationRequest }
        
        let nextPageRequest = loadNextPageTrigger
            .take(1)
            .flatMap { nextPage.map { Observable.of(paginationRequest.routeWithPage($0)) } ?? Observable.empty() }
        
        let request = Observable
            .of(refreshRequest, nextPageRequest)
            .merge()
            .take(1)
            .shareReplay(1)
        
        let response = request
            .flatMap { $0.rx_collection() }
            .shareReplay(1)
        
        Observable
            .of(
                request.map { (true, $0.page) },

            .bindTo(refreshTrigger)
            .addDisposableTo(queryDisposeBag)
    }

    private func bindPaginationRequest(paginationRequest: PaginationRequest<Element, Filter>, nextPage: String?) {
        disposeBag = DisposeBag()
        self.paginationRequest = paginationRequest
