Skip to content

Commit

Permalink
refactor: address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir committed Jan 17, 2024
1 parent acec545 commit 574b74f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions Discovery/Discovery/Data/DiscoveryRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@ public class DiscoveryRepository: DiscoveryRepositoryProtocol {

public func enrollToCourse(courseID: String) async throws -> Bool {
let enroll = try await api.request(DiscoveryEndpoint.enrollToCourse(courseID: courseID))
if enroll.statusCode == 200 {
return true
} else {
return false
}
return enroll.statusCode == 200
}
}

Expand Down
4 changes: 2 additions & 2 deletions Discovery/Discovery/Data/Network/DiscoveryEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ enum DiscoveryEndpoint: EndPointType {
return "/api/courses/v1/courses/"
case .getCourseDetail(courseID: let courseID, _):
return "/api/courses/v1/courses/\(courseID)"
case .enrollToCourse(courseID: _):
case .enrollToCourse:
return "/api/enrollment/v1/enrollment"
}
}
Expand All @@ -32,7 +32,7 @@ enum DiscoveryEndpoint: EndPointType {
switch self {
case .getDiscovery, .searchCourses:
return .get
case .getCourseDetail(courseID: _, username: _):
case .getCourseDetail:
return .get
case .enrollToCourse:
return .post
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public extension URL {
}

var isValidAppURLScheme: Bool {
return scheme ?? "" == URIString.appURLScheme.rawValue
return scheme ?? "" == URIString.appURLScheme.rawValue
}

var queryParameters: [String: Any]? {
Expand Down

0 comments on commit 574b74f

Please sign in to comment.