import { rxHttpGet } from 'redux-rx-http' import { SEARCH_ADDRESS } from './constants' import { AbstractFormField } from '../form-field' export interface SearchAddressAction { type: 'SEARCH_ADDRESS_REQUEST' args: { name: string, formName: string, } } export interface SearchAddressSuccessAction { type: 'SEARCH_ADDRESS_SUCCESS' args: { name: string, formName: string, } } export interface SearchAddressErrorAction { type: 'SEARCH_ADDRESS_ERROR' args: { name: string, formName: string, } } export type AddressAction = SearchAddressAction | SearchAddressSuccessAction | SearchAddressErrorAction export const searchAddress = (name: string, formName: string, field: AbstractFormField) => rxHttpGet('/search', SEARCH_ADDRESS, { country: 'GB', query: field.value, take: 7, })