You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
534 B
28 lines
534 B
import { DATA_URL, PROCEDURES } from 'config'
|
|
import { callApi, getResponseData } from 'helpers'
|
|
|
|
const proc = PROCEDURES.get_cities
|
|
|
|
export type City = {
|
|
id: number,
|
|
name: string,
|
|
}
|
|
|
|
export type Cities = Array<City>
|
|
|
|
export const getCountryCities = (query: string, countryId: number): Promise<Cities> => {
|
|
const config = {
|
|
body: {
|
|
params: {
|
|
_p_country_id: countryId,
|
|
_p_name: query,
|
|
},
|
|
proc,
|
|
},
|
|
}
|
|
|
|
return callApi({
|
|
config,
|
|
url: DATA_URL,
|
|
}).then(getResponseData(proc))
|
|
}
|
|
|