@@ -194,19 +194,20 @@ export default {
194194 shareType .push (this .SHARE_TYPES .SHARE_TYPE_EMAIL )
195195 }
196196
197- const request = await axios .get (generateOcsUrl (' apps/files_sharing/api/v1' ) + ' sharees' , {
198- params: {
199- format: ' json' ,
200- itemType: this .fileInfo .type === ' dir' ? ' folder' : ' file' ,
201- search,
202- lookup,
203- perPage: this .config .maxAutocompleteResults ,
204- shareType,
205- },
206- })
207-
208- if (request .data .ocs .meta .statuscode !== 100 ) {
209- console .error (' Error fetching suggestions' , request)
197+ let request = null
198+ try {
199+ request = await axios .get (generateOcsUrl (' apps/files_sharing/api/v1' , 2 ) + ' sharees' , {
200+ params: {
201+ format: ' json' ,
202+ itemType: this .fileInfo .type === ' dir' ? ' folder' : ' file' ,
203+ search,
204+ lookup,
205+ perPage: this .config .maxAutocompleteResults ,
206+ shareType,
207+ },
208+ })
209+ } catch (error) {
210+ console .error (' Error fetching suggestions' , error)
210211 return
211212 }
212213
@@ -283,24 +284,25 @@ export default {
283284 async getRecommendations () {
284285 this .loading = true
285286
286- const request = await axios .get (generateOcsUrl (' apps/files_sharing/api/v1' ) + ' sharees_recommended' , {
287- params: {
288- format: ' json' ,
289- itemType: this .fileInfo .type ,
290- },
291- })
292-
293- if (request .data .ocs .meta .statuscode !== 100 ) {
294- console .error (' Error fetching recommendations' , request)
287+ let request = null
288+ try {
289+ request = await axios .get (generateOcsUrl (' apps/files_sharing/api/v1' , 2 ) + ' sharees_recommended' , {
290+ params: {
291+ format: ' json' ,
292+ itemType: this .fileInfo .type ,
293+ },
294+ })
295+ } catch (error) {
296+ console .error (' Error fetching recommendations' , error)
295297 return
296298 }
297299
300+ // Add external results from the OCA.Sharing.ShareSearch api
298301 const externalResults = this .externalResults .filter (result => ! result .condition || result .condition (this ))
299302
300- const exact = request .data .ocs .data .exact
301-
302303 // flatten array of arrays
303- const rawRecommendations = Object .values (exact).reduce ((arr , elem ) => arr .concat (elem), [])
304+ const rawRecommendations = Object .values (request .data .ocs .data .exact )
305+ .reduce ((arr , elem ) => arr .concat (elem), [])
304306
305307 // remove invalid data and format to user-select layout
306308 this .recommendations = this .filterOutExistingShares (rawRecommendations)
0 commit comments