Skip to content

Commit

Permalink
refactor: api -> apiService 프로퍼티 네이밍 변경 #14
Browse files Browse the repository at this point in the history
  • Loading branch information
yim2627 committed Jan 27, 2022
1 parent c0b0c0a commit bc83fd9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MainViewController: UIViewController {
private var listDataSource: UICollectionViewDiffableDataSource<ProductSection, ProductDetail>?
private var gridDataSource: UICollectionViewDiffableDataSource<ProductSection, ProductDetail>?
private var productData: [ProductDetail] = []
private let api = APIService()
private let apiService = APIService()

private lazy var activityIndicator: UIActivityIndicatorView = {
let indicator = UIActivityIndicatorView()
Expand All @@ -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
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit bc83fd9

Please sign in to comment.