Using axios in registerAutocompleteListener

Can someone help me understand how to use registerAutocompleteListener correct? I return a promise with axios.get(‘api-url’) in the listener but i get a red triangle in my input-field.

`
.registerAutocompleteListener(( query, args ) => {

				return new Promise(function(resolve, reject) {
					axios.get('http://api-url.com/=' + encodeURIComponent(query))

						.then(response => {
		
						if(response.data.length > 1) {
							searchResult = response.data
												.map((item) => {
													return {
														name: item.name,
														id: item.id
													}
												});
							return resolve(searchResult);
						} else {
							return resolve([{name: "Nothing found!"}]);
						}
						
						})
						.catch(error => {
							reject(error);
						});
				});
				
			}
		})`