Skip to content

Commit

Permalink
πŸ”¨[FIX] : #177 ν…Œλ§ˆ URL λ³€κ²½, Model μˆ˜μ •
Browse files Browse the repository at this point in the history
  • Loading branch information
comeheredart committed Dec 30, 2021
1 parent c2db5f2 commit 683c013
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
5 changes: 3 additions & 2 deletions ChaRo-iOS/ChaRo-iOS/Source/Models/ThemeDataModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import Foundation
struct ThemeDataModel: Codable {
let success: Bool
let msg: String
let data: TotalDrive
let data: Drive
}

// MARK: - TotalDrive
struct TotalDrive: Codable {
let totalCourse: Int
let lastId: Int
let lastCount: Int
let drive: [Drive]
}

Expand Down
4 changes: 2 additions & 2 deletions ChaRo-iOS/ChaRo-iOS/Source/Services/Contants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ struct Constants {
static let newDetailURL = baseURL + "/preview/new/" + userId + "/"

///4.
static let ThemeLikeURL = baseURL + "/preview/like/\(userId)/1?value="
static let ThemeNewURL = baseURL + "/preview/new/\(userId)/1?value="
static let ThemeLikeURL = baseURL + "/post/preview/like/\(userId)/1?value="
static let ThemeNewURL = baseURL + "/post/preview/new/\(userId)/1?value="
static let likeURL = baseURL + "/post/like"

///myPage
Expand Down
9 changes: 6 additions & 3 deletions ChaRo-iOS/ChaRo-iOS/Source/Services/GetThemeDataService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ struct GetThemeDataService {

case Filter.like:
URL = Constants.ThemeLikeURL + "\(theme)"

print("응닡 μ½”λ“œ \(URL)")
break

case Filter.new:
URL = Constants.ThemeNewURL + "\(theme)"
print("응닡 μ½”λ“œ \(URL)")
break
}

Expand All @@ -47,7 +49,7 @@ struct GetThemeDataService {
switch dataResponse.result {

case .success:

print("ν…Œλ§ˆ 데이터 ----- 데이터 μš”μ²­ 성곡")
guard let statusCode = dataResponse.response?.statusCode else {return}
guard let value = dataResponse.value else {return}
let networkResult = self.judgeStatus(by: statusCode, value)
Expand All @@ -61,10 +63,11 @@ struct GetThemeDataService {
}

private func judgeStatus(by statusCode: Int, _ data: Data) -> NetworkResult<Any> {
print("ν…Œλ§ˆ 데이터 ----- 데이터 μ‘λ‹΅μ½”λ“œ \(statusCode)")
let decoder = JSONDecoder()
guard let decodedData = try? decoder.decode(ThemeDataModel.self, from: data)
else { return .pathErr}

switch statusCode {

case 200:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,10 @@ class ThemePostVC: UIViewController {
switch(response)
{
case .success(let driveData):

print(driveData)
if let object = driveData as? TotalDrive {
self.cellCount = object.totalCourse

if let drive = object.drive as? [Drive] {
self.selectedDriveList = drive
}
self.cellCount = object.drive.count
self.selectedDriveList = object.drive

self.tableView.reloadData()
}
Expand Down

0 comments on commit 683c013

Please sign in to comment.