From bc83fd99f476650eaf74f8e5ed99b9f8d2d27ed4 Mon Sep 17 00:00:00 2001 From: yim2627 Date: Thu, 27 Jan 2022 14:58:23 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20api=20->=20apiService=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=ED=8D=BC=ED=8B=B0=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20#14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail/Controller/ProductDetailViewController.swift | 6 +++--- .../Scene/Main/Controller/MainViewController.swift | 6 +++--- .../Scene/Register/Controller/ProductRegisterManager.swift | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/OpenMarket/OpenMarket/Scene/Detail/Controller/ProductDetailViewController.swift b/OpenMarket/OpenMarket/Scene/Detail/Controller/ProductDetailViewController.swift index 4eca4337a..1b42cef9f 100644 --- a/OpenMarket/OpenMarket/Scene/Detail/Controller/ProductDetailViewController.swift +++ b/OpenMarket/OpenMarket/Scene/Detail/Controller/ProductDetailViewController.swift @@ -3,7 +3,7 @@ import UIKit final class ProductDetailViewController: UIViewController { private let productDetailScrollView = ProductDetailScrollView() private var productDetail: ProductDetail - private let api = APIService() + private let apiService = APIService() init(productDetail: ProductDetail) { self.productDetail = productDetail @@ -155,7 +155,7 @@ extension ProductDetailViewController { return } let productPassword = ProductPassword(secret: VendorInformation.secret) - api.retrieveProductSecret(productId: productDetail.id, password: productPassword) { result in + apiService.retrieveProductSecret(productId: productDetail.id, password: productPassword) { result in switch result { case .success(let password): DispatchQueue.main.async { @@ -172,7 +172,7 @@ extension ProductDetailViewController { } private func deleteProduct(productId: Int, secret: String) { - api.deleteProduct(productId: productId, secret: secret) { result in + apiService.deleteProduct(productId: productId, secret: secret) { result in switch result { case .success(_): DispatchQueue.main.async { diff --git a/OpenMarket/OpenMarket/Scene/Main/Controller/MainViewController.swift b/OpenMarket/OpenMarket/Scene/Main/Controller/MainViewController.swift index fcfbf448b..8ee00dc57 100644 --- a/OpenMarket/OpenMarket/Scene/Main/Controller/MainViewController.swift +++ b/OpenMarket/OpenMarket/Scene/Main/Controller/MainViewController.swift @@ -27,7 +27,7 @@ class MainViewController: UIViewController { private var listDataSource: UICollectionViewDiffableDataSource? private var gridDataSource: UICollectionViewDiffableDataSource? private var productData: [ProductDetail] = [] - private let api = APIService() + private let apiService = APIService() private lazy var activityIndicator: UIActivityIndicatorView = { let indicator = UIActivityIndicatorView() @@ -51,7 +51,7 @@ class MainViewController: UIViewController { @objc private func fetchProductData() { activityIndicator.startAnimating() - api.retrieveProductList(pageNo: RequestInformation.pageNumber, itemsPerPage: RequestInformation.itemsPerPage) { result in + apiService.retrieveProductList(pageNo: RequestInformation.pageNumber, itemsPerPage: RequestInformation.itemsPerPage) { result in switch result { case .success(let data): self.productData = data.pages @@ -65,7 +65,7 @@ class MainViewController: UIViewController { } private func showProductDetail(from id: Int) { - api.retrieveProductDetail(productId: id) { result in + apiService.retrieveProductDetail(productId: id) { result in switch result { case .success(let productDetail): DispatchQueue.main.async { diff --git a/OpenMarket/OpenMarket/Scene/Register/Controller/ProductRegisterManager.swift b/OpenMarket/OpenMarket/Scene/Register/Controller/ProductRegisterManager.swift index 0295d6cfe..7537e124c 100644 --- a/OpenMarket/OpenMarket/Scene/Register/Controller/ProductRegisterManager.swift +++ b/OpenMarket/OpenMarket/Scene/Register/Controller/ProductRegisterManager.swift @@ -4,7 +4,7 @@ class ProductRegisterManager { weak var pickerPresenterDelegate: PickerPresenter? let productInformationScrollView = ProductInformationScrollView() private lazy var productInformationView = productInformationScrollView.productInformationView - private let api = APIService() + private let apiService = APIService() init() { NotificationCenter.default.addObserver(self, selector: #selector(showAddImageButton), name: .imageRemoved, object: nil) productInformationView.addImageButton.addTarget(self, action: #selector(didTapAddImageButton), for: .touchUpInside) @@ -156,7 +156,7 @@ class ProductRegisterManager { let productRegisterInformation = createProductRegisterInformation() let imagesDatas = takeRegisteredImages() - api.registerProduct(newProduct: productRegisterInformation, images: imagesDatas) { result in + apiService.registerProduct(newProduct: productRegisterInformation, images: imagesDatas) { result in switch result { case .success(_): DispatchQueue.main.async { @@ -171,7 +171,7 @@ class ProductRegisterManager { func update(productId: Int) { let productRegisterInformation = createProductRegisterInformation() - api.updateProduct(productId: productId, modifiedProduct: productRegisterInformation) { result in + apiService.updateProduct(productId: productId, modifiedProduct: productRegisterInformation) { result in switch result { case .success(let modifiedData): DispatchQueue.main.async {