<?php

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');

require '../../modelo/ruta.php';
require '../../modelo/categoria.php';
require '../../modelo/subcategoria.php';

$categorias = Categoria::mdlGetCategorias();
$response = array();

if (!$categorias) {
    $response['response'] = 'error';
    $response['message'] = 'No se encontraron categorias';
    echo json_encode($response);
    return;
}

$response['response'] = 'success';
$response['data'] = $categorias;
echo json_encode($response);
