diff LazyBear/Views/Profile/Networking/Profile.swift @ 401:f843c6382529

Add Enumeration to Networks files
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Thu, 20 May 2021 21:04:49 +0200
parents 4c90e5b18632
children 444ec927d62f
line wrap: on
line diff
--- a/LazyBear/Views/Profile/Networking/Profile.swift	Sat May 15 19:54:20 2021 +0200
+++ b/LazyBear/Views/Profile/Networking/Profile.swift	Thu May 20 21:04:49 2021 +0200
@@ -11,17 +11,15 @@
     @Published var showView = false
     @Published var data = ProfileResponse()
     
-    func request(_ url: String, isInitRequest: Bool) {
+    func request(_ url: String, _ requestType: RequestType) {
         genericRequest(url: url, model: ProfileResponse.self) { response in
-
-            // If is the first request -> init()
-            if isInitRequest {
+            switch requestType {
+            case .initial:
                 self.data = response
-            } else {
-                 // If not, request streaming data (without intradayPrices)
+            default:
                 self.data.quotes = response.quotes
             }
-
+            
             self.showView = true
         }
     }