Description
Found some errors in code:
getData(value: string, type: DadataType = DadataType.address, config: DadataConfig): Observable {
const httpOptions = {
headers: new HttpHeaders({
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: 'Token ' + this.apiKey,
})
};
const body = Object.assign(
{},
{query: value},
{count: config?.limit},
{location: config?.locations},
{location_bust: config?.locationsBoost},
{from_bound: config?.bounds?.fromBound},
{to_bound: config?.bounds?.toBound}
);
return this.http.post('https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/' + type, body, httpOptions);
}
should be:
getData(value: string, type: DadataType = DadataType.address, config: DadataConfig): Observable {
const httpOptions = {
headers: new HttpHeaders({
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: 'Token ' + this.apiKey,
})
};
const body = Object.assign(
{},
{query: value},
{count: config?.limit},
{locations: config?.locations},
{location_boost: config?.locationsBoost},
{from_bound: config?.bounds?.fromBound},
{to_bound: config?.bounds?.toBound}
);
return this.http.post('https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/' + type, body, httpOptions);
}