refactor(ui): store suggestion fetch result so we can use it in tests

This commit is contained in:
Łukasz Mierzwa
2018-08-30 21:09:43 +01:00
parent 13130f187a
commit e1bb3d6548

View File

@@ -31,6 +31,7 @@ const FilterInput = observer(
{
ref: null,
suggestions: [],
suggestionsFetch: null,
value: "",
storeInputReference(ref) {
this.ref = ref;
@@ -70,7 +71,9 @@ const FilterInput = observer(
onSuggestionsFetchRequested = debounce(
action(({ value }) => {
if (value !== "") {
fetch(FormatUnseeBackendURI(`autocomplete.json?term=${value}`))
this.inputStore.suggestionsFetch = fetch(
FormatUnseeBackendURI(`autocomplete.json?term=${value}`)
)
.then(
result => result.json(),
err => {