Your IP : 3.148.170.88


Current Path : /var/www/axolotl/data/www/axolotl.ru/www/bitrix/js/location/osm/src/requesters/
Upload File :
Current File : /var/www/axolotl/data/www/axolotl.ru/www/bitrix/js/location/osm/src/requesters/searchrequester.js

import BaseRequester from './baserequester';

export default class SearchRequester extends BaseRequester
{
	createUrl(params: { query: string, viewbox: string, limit: ?number }): string
	{
		const limit = params.limit ?? 5;

		let result = `${this.serviceUrl}/?
			action=osmgateway.location.search
			&params[q]=${encodeURIComponent(params.query)}
			&params[format]=json
			&params[limit]=${limit}
			&params[accept-language]=${this.sourceLanguageId}`;

		if (params.viewbox)
		{
			result += `&params[viewbox]=${params.viewbox}`;
		}

		return result;
	}
}