@@ -70,19 +70,19 @@ class InitialViewModel: ObservableObject {
7070
7171 }
7272
73- func fetchLongQuestsFor( workspaceId: String , completion: @escaping ( Bool , String ? ) -> Void ) {
73+ func fetchLongQuestsFor( workspaceId: String , completion: @escaping ( Bool , String ? , Workspace ? ) -> Void ) {
7474
7575 isLoading = true
7676
7777 ApiManager . shared. performRequest ( to: . fetchWorkspaceDetails( workspaceId) , setupType: . workspace, modelType: Workspace . self) { [ weak self] result in
78- guard let self = self else { return completion ( false , " Object memory released. " ) }
78+ guard let self = self else { return completion ( false , " Object memory released. " , nil ) }
7979 DispatchQueue . main. async { [ unowned self] in
8080 switch result {
8181 case . success( let workspaces) :
8282
8383 guard let longQuestsResponse = workspaces. longFormQuest else {
8484 self . isLoading = false
85- completion ( false , " Please configure longform. " )
85+ completion ( false , " Please configure longform. " , nil )
8686 return
8787 }
8888 // Validate quest query
@@ -93,7 +93,7 @@ class InitialViewModel: ObservableObject {
9393 } catch {
9494 print ( " Invalid quest filter: \( error) " )
9595 self . isLoading = false
96- completion ( false , " Invalid quest query. " )
96+ completion ( false , " Invalid quest query. " , workspaces )
9797 return
9898 }
9999
@@ -117,11 +117,11 @@ class InitialViewModel: ObservableObject {
117117 }
118118
119119 self . isLoading = false
120- completion ( true , " " )
120+ completion ( true , " " , workspaces )
121121 case . failure( let error) :
122122 print ( " ERROR from workspace details api ----?>>>>>> \( error. localizedDescription) " )
123123 self . isLoading = false
124- completion ( false , " Not able to load the workspace details. Please try again later. " )
124+ completion ( false , " Not able to load the workspace details. Please try again later. " , nil )
125125 }
126126 }
127127 }
0 commit comments