Skip to content

Commit 2207958

Browse files
committed
Use v5 autocomplete endpoint for handle search in assignee dropdown
1 parent 8e7d286 commit 2207958

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/components/SelectUserAutocomplete/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import React, { useState, useCallback } from 'react'
88
import PropTypes from 'prop-types'
99
import Select from '../Select'
10-
import { suggestProfiles, fetchProfileV5 } from '../../services/user'
10+
import { suggestProfilesV5, fetchProfileV5 } from '../../services/user'
1111
import _ from 'lodash'
1212
import { 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,

src/services/user.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
}

0 commit comments

Comments
 (0)