From 3513f79db7376dfcb5dfde78c04a17ec4af89708 Mon Sep 17 00:00:00 2001 From: Ivan Smolin Date: Thu, 29 Mar 2018 18:19:07 +0300 Subject: [PATCH] fix page increment on failed response --- .../Code/ViewModel/cursor_model.swift.liquid | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/touchin-pagination/Code/ViewModel/cursor_model.swift.liquid b/touchin-pagination/Code/ViewModel/cursor_model.swift.liquid index 5a45ab5..dcf30ea 100644 --- a/touchin-pagination/Code/ViewModel/cursor_model.swift.liquid +++ b/touchin-pagination/Code/ViewModel/cursor_model.swift.liquid @@ -16,11 +16,11 @@ final class {{ module_info.name }}CursorConfiguration: TotalCountCursorConfigura } func resultSingle() -> Single { - defer { - page += 1 - } - - return NetworkService.shared.listing(page: page) + return NetworkService.shared + .listing(page: page) + .do(onSuccess: { [weak self] _ in + self?.page += 1 + }) } }