File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
components/SelectUserAutocomplete Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 77import React , { useState , useCallback } from 'react'
88import PropTypes from 'prop-types'
99import Select from '../Select'
10- import { suggestProfiles , fetchProfileV5 } from '../../services/user'
10+ import { suggestProfilesV5 , fetchProfileV5 } from '../../services/user'
1111import _ from 'lodash'
1212import { AUTOCOMPLETE_MIN_LENGTH , AUTOCOMPLETE_DEBOUNCE_TIME_MS } from '../../config/constants'
1313
@@ -27,7 +27,7 @@ export default function SelectUserAutocomplete (props) {
2727 return
2828 }
2929
30- Promise . all ( [ suggestProfiles ( inputValue ) , fetchProfileV5 ( inputValue ) ] ) . then (
30+ Promise . all ( [ suggestProfilesV5 ( inputValue ) , fetchProfileV5 ( inputValue ) ] ) . then (
3131 ( [ suggestions , user ] ) => {
3232 const suggestedOptions = suggestions . map ( ( u ) => ( {
3333 label : u . handle ,
Original file line number Diff line number Diff line change @@ -59,3 +59,12 @@ export async function suggestProfiles (partialHandle) {
5959 const response = await axiosInstance . get ( `${ MEMBER_API_V3_URL } /_suggest/${ encodeURIComponent ( partialHandle ) } ` )
6060 return _ . get ( response , 'data.result.content' )
6161}
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