package Mojolicious::Plugin::Inertia;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::JSON qw(encode_json);
use Scalar::Util qw(reftype);
use Carp qw(croak);
our $VERSION = "0.01";
sub register {
tory,
};
# Check if the request is an Inertia request.
# If so, return a JSON response.
# Else, return an HTML response with embedded page object.
# Ref: https
rue');
$c->res->headers->header('Vary' => 'X-Inertia');
return $c->render(json => $page_object);
}
else {
$c->res->headers->header('Vary' => 'X-Iner