diff --git a/Keyneez/Keyneez/Global/NetworkLayer/ContentAPI.swift b/Keyneez/Keyneez/Global/NetworkLayer/ContentAPI.swift index ad96b37..d2bdc78 100644 --- a/Keyneez/Keyneez/Global/NetworkLayer/ContentAPI.swift +++ b/Keyneez/Keyneez/Global/NetworkLayer/ContentAPI.swift @@ -13,7 +13,7 @@ enum ContentAPI { case getDetailContent(token: String, contentId: Int) case getSearchContent(token: String, keyword: String) case postLikeContent - case getLikedContent + case getLikedContent(token: String) } extension ContentAPI: TargetType { @@ -63,7 +63,10 @@ extension ContentAPI: TargetType { var headers: [String: String]? { switch self { - case .getAllContents(let token), .getSearchContent(let token, _), .getDetailContent(let token, _): + case .getAllContents(let token), + .getSearchContent(let token, _), + .getDetailContent(let token, _), + .getLikedContent(let token): return ["Content-Type": "application/json", "Authorization": token] default: return nil diff --git a/Keyneez/Keyneez/Global/NetworkLayer/ContentAPIProvider.swift b/Keyneez/Keyneez/Global/NetworkLayer/ContentAPIProvider.swift index e48a1e1..1d5835a 100644 --- a/Keyneez/Keyneez/Global/NetworkLayer/ContentAPIProvider.swift +++ b/Keyneez/Keyneez/Global/NetworkLayer/ContentAPIProvider.swift @@ -23,6 +23,10 @@ final class ContentAPIProvider { let target = ContentAPI.getDetailContent(token: token, contentId: contentId) requestFrom(target, modelType: ContentDetailResponseDto.self, completion: completion) } + func getLikedContent(token: String, completion: @escaping (Result) -> Void) { + let target = ContentAPI.getLikedContent(token: token) + requestFrom(target, modelType: LikeContentResponseDto.self, completion: completion) + } } extension ContentAPIProvider { diff --git a/Keyneez/Keyneez/Global/NetworkLayer/DTO/Like/MyLikedContentResponseDto.swift b/Keyneez/Keyneez/Global/NetworkLayer/DTO/Like/MyLikedContentResponseDto.swift index 94fe25f..8500ac3 100644 --- a/Keyneez/Keyneez/Global/NetworkLayer/DTO/Like/MyLikedContentResponseDto.swift +++ b/Keyneez/Keyneez/Global/NetworkLayer/DTO/Like/MyLikedContentResponseDto.swift @@ -13,7 +13,7 @@ struct MyLikedContentResponseDto: Codable { let data: [MyLikedContentResponseData] } -struct MyLikedContentResponseData: Codable { +struct MyLikedContentResponseDto: Codable { let contentKey: Int let contentTitle, startAt,