File tree 2 files changed +11
-2
lines changed
components/SelectUserAutocomplete 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 7
7
import React , { useState , useCallback } from 'react'
8
8
import PropTypes from 'prop-types'
9
9
import Select from '../Select'
10
- import { suggestProfiles , fetchProfileV5 } from '../../services/user'
10
+ import { suggestProfilesV5 , fetchProfileV5 } from '../../services/user'
11
11
import _ from 'lodash'
12
12
import { AUTOCOMPLETE_MIN_LENGTH , AUTOCOMPLETE_DEBOUNCE_TIME_MS } from '../../config/constants'
13
13
@@ -27,7 +27,7 @@ export default function SelectUserAutocomplete (props) {
27
27
return
28
28
}
29
29
30
- Promise . all ( [ suggestProfiles ( inputValue ) , fetchProfileV5 ( inputValue ) ] ) . then (
30
+ Promise . all ( [ suggestProfilesV5 ( inputValue ) , fetchProfileV5 ( inputValue ) ] ) . then (
31
31
( [ suggestions , user ] ) => {
32
32
const suggestedOptions = suggestions . map ( ( u ) => ( {
33
33
label : u . handle ,
Original file line number Diff line number Diff line change @@ -59,3 +59,12 @@ export async function suggestProfiles (partialHandle) {
59
59
const response = await axiosInstance . get ( `${ MEMBER_API_V3_URL } /_suggest/${ encodeURIComponent ( partialHandle ) } ` )
60
60
return _ . get ( response , 'data.result.content' )
61
61
}
62
+
63
+ /**
64
+ * Api request for finding (suggesting) users by the part of the handle
65
+ * @returns {Promise<*> }
66
+ */
67
+ export async function suggestProfilesV5 ( partialHandle ) {
68
+ const response = await axiosInstance . get ( `${ MEMBER_API_URL } /autocomplete?term=${ encodeURIComponent ( partialHandle ) } ` )
69
+ return _ . get ( response , 'data' )
70
+ }
You can’t perform that action at this time.
0 commit comments