Updated default limit for airports
This commit is contained in:
1
.env
1
.env
@@ -35,6 +35,7 @@ SSL_CERT_PATH=../ssl/localhost.crt
|
|||||||
SSL_CERT_KEY_PATH=../ssl/localhost.key
|
SSL_CERT_KEY_PATH=../ssl/localhost.key
|
||||||
|
|
||||||
VITE_API_URL=${NGINX_PROTOCOL}://${NGINX_HOST}:${NGINX_HTTP_PORT}/api
|
VITE_API_URL=${NGINX_PROTOCOL}://${NGINX_HOST}:${NGINX_HTTP_PORT}/api
|
||||||
|
VITE_DEFAULT_LIMIT=200
|
||||||
__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS:${NGINX_HOST}
|
__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS:${NGINX_HOST}
|
||||||
|
|
||||||
ENVIRONMENT=development
|
ENVIRONMENT=development
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { Airport, AirportCategory, Bounds, GetAirportsResponse } from '@lib/airport.types.ts';
|
import { Airport, AirportCategory, Bounds, GetAirportsResponse } from '@lib/airport.types.ts';
|
||||||
import { getRequest } from '@lib/index.ts';
|
import { getRequest } from '@lib/index.ts';
|
||||||
|
|
||||||
|
const defaultLimit = import.meta.env.VITE_DEFAULT_LIMIT || 150;
|
||||||
|
|
||||||
export async function getAirport({ icao }: { icao: string }): Promise<Airport> {
|
export async function getAirport({ icao }: { icao: string }): Promise<Airport> {
|
||||||
const response = await getRequest(`airports/${icao}`);
|
const response = await getRequest(`airports/${icao}`);
|
||||||
return response?.json() || {};
|
return response?.json() || {};
|
||||||
@@ -22,7 +24,7 @@ export async function getAirports({
|
|||||||
categories,
|
categories,
|
||||||
bounds,
|
bounds,
|
||||||
metars = false,
|
metars = false,
|
||||||
limit = 1000,
|
limit = defaultLimit,
|
||||||
page = 1
|
page = 1
|
||||||
}: GetAirportsParameters): Promise<GetAirportsResponse> {
|
}: GetAirportsParameters): Promise<GetAirportsResponse> {
|
||||||
const response = await getRequest('airports', {
|
const response = await getRequest('airports', {
|
||||||
|
|||||||
Reference in New Issue
Block a user