'use client';

import type { CityTariffRow } from './types';

export async function fetchCities(): Promise<CityTariffRow[]> {
  const res = await fetch('/api/cities', { method: 'GET' });
  if (!res.ok) throw new Error('Failed to load cities');
  const json = (await res.json()) as { cities?: CityTariffRow[] };
  return Array.isArray(json.cities) ? json.cities : [];
}

