46 lines
960 B
TypeScript
46 lines
960 B
TypeScript
import apiService from './api.service'
|
|
|
|
export interface CountryDto {
|
|
id: string
|
|
name: string
|
|
phoneCode: number
|
|
phoneNumberMinLength: number | null
|
|
phoneNumberMaxLength: number | null
|
|
phoneNumberFormat: string | null
|
|
}
|
|
|
|
export interface CityDto {
|
|
id: string
|
|
country: string
|
|
name: string
|
|
plateCode?: string
|
|
}
|
|
|
|
export interface DistrictDto {
|
|
id: string
|
|
country: string
|
|
city: string
|
|
name: string
|
|
township?: string
|
|
postalCode?: string
|
|
}
|
|
|
|
export const getCountries = () =>
|
|
apiService.fetchData<CountryDto[]>({
|
|
method: 'GET',
|
|
url: '/api/app/public/country',
|
|
})
|
|
|
|
export const getCities = (country: string) =>
|
|
apiService.fetchData<CityDto[]>({
|
|
method: 'GET',
|
|
url: '/api/app/public/city',
|
|
params: { country },
|
|
})
|
|
|
|
export const getDistricts = (country: string, city: string) =>
|
|
apiService.fetchData<DistrictDto[]>({
|
|
method: 'GET',
|
|
url: '/api/app/public/district',
|
|
params: { country, city },
|
|
})
|