From 89a23f21ca25c9ced74cc5f47ba8e77239624097 Mon Sep 17 00:00:00 2001 From: gme_2 Date: Tue, 19 Mar 2019 14:07:47 +0900 Subject: [PATCH] resend lit api added --- .../Service/ResendServiceType.swift | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/GMERemittance/Module/Resend/Application Logic/Service/ResendServiceType.swift b/GMERemittance/Module/Resend/Application Logic/Service/ResendServiceType.swift index 3f577b0b..53e8a446 100644 --- a/GMERemittance/Module/Resend/Application Logic/Service/ResendServiceType.swift +++ b/GMERemittance/Module/Resend/Application Logic/Service/ResendServiceType.swift @@ -14,20 +14,24 @@ protocol ResendServiceType: class { } -protocol FetchResendTransactionList: ApiServiceType { - func fetch() +protocol FetchResendService: ApiServiceType { + func fetchResendService(user: String, param: [String: String]?, success: @escaping (([ResendListModel]) -> ()), failure: @escaping ((Error) -> ())) } - -extension FetchResendTransactionList { - func fetch() { - // http://localhost:9500/api/v1/resend/list - let url = baseUrl + "v1/resend/list" - - auth.request(method: .post, url: url, params: nil, success: { (response: SuccessMessageContainer) in - print(response) +extension FetchResendService { + func fetchResendService(user: String, param: [String: String]?, success: @escaping (([ResendListModel]) -> ()), failure: @escaping ((Error) -> ())) { + let url = oldBaseUrl + "v1/resend/list" + "\(user)" + self.auth.request(method: .post, url: url, params: param, success: { (response: ResendListModelContainer) in + if (response.errorCode ?? "") == "1" { + let error = NSError.init(domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""]) + failure(error) + }else { + let model = response.data + success(model ?? []) + } + }) { (error) in - print(error.localizedDescription) + failure(error) } } }