<?php
// admin/get-subcategories.php
require_once __DIR__ . '/../includes/config.php';
require_once __DIR__ . '/../includes/functions.php';

if (!isAdmin()) {
    exit;
}

$category_id = intval($_POST['category_id'] ?? 0);
$subcategories = getSubcategories($pdo, $category_id);
echo json_encode($subcategories);
?>