Use api client for auto complete

This commit is contained in:
Rene Pfeuffer
2019-11-21 13:06:22 +01:00
parent c81e78998e
commit 9cf55b8335
3 changed files with 9 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
import React from "react";
import { SelectValue, AutocompleteObject } from "@scm-manager/ui-types";
import Autocomplete from "./Autocomplete";
import { apiClient } from "./apiclient";
export type AutocompleteProps = {
autocompleteLink?: string;
@@ -19,7 +20,8 @@ export default class UserGroupAutocomplete extends React.Component<Props> {
loadSuggestions = (inputValue: string): Promise<SelectValue[]> => {
const url = this.props.autocompleteLink;
const link = url + "?q=";
return fetch(link + inputValue)
return apiClient
.get(link + inputValue)
.then(response => response.json())
.then((json: AutocompleteObject[]) => {
return json.map(element => {