Skip to content

Commit

Permalink
feat: (#16) OpenIssue 정보 url 추가 및 get 메서드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
torch-ray committed Jun 9, 2021
1 parent fb7adb4 commit 145f3e2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions IssueTracker/IssueTracker/Data/Constant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ enum ViewControllerID {
static let issueFilter = "FilterVC"
static let tabBar = "TabBarVC"
}

enum API {
static let getOpenIssue = URL(string: "http://3.37.76.224/api/issues?status=open%27")
}
2 changes: 1 addition & 1 deletion IssueTracker/IssueTracker/Data/IssueDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation

struct IssueDTO: Decodable {
let count: Count
let issue: [Issue]
let issues: [Issue]
}

struct Count: Decodable {
Expand Down
5 changes: 3 additions & 2 deletions IssueTracker/IssueTracker/Data/Network/APIService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import RxSwift
import Alamofire

protocol NetworkPort {
func get(_ url:URL) -> Observable<IssueDTO>
static func get(_ url:URL?) -> Observable<IssueDTO>
}

class APIService:NetworkPort {

func get(_ url: URL) -> Observable<IssueDTO> {
static func get(_ url: URL?) -> Observable<IssueDTO> {
return Observable.create { observer in
guard let url = url else { return Disposables.create()}
AF.request(url, method: .get)
.responseDecodable(of: IssueDTO.self) { response in
switch response.result {
Expand Down

0 comments on commit 145f3e2

Please sign in to comment.