Creating child page from POST request

I am trying to use a controller in Kirby 3 to create a child after a POST request.

My controller looks like this:

<?php
return function($site, $pages, $page) {
  $error = null;
  if(r::method() === 'POST') {
    $data = array(
      'firstname' => get('firstname'),
      'lastname' => get('lastname'),
      'email' => get('email'),
    );
    try {
      $page->createChild([
        'slug'     => uniqid(),
        'template' => 'submission'
      ]);
    } catch(Exception $e) {
      echo json_encode(array('errorMsg' => $e->getMessage()), JSON_HEX_QUOT | JSON_HEX_TAG);
    }
  }
  return compact('error');
};

obviously the page will have content from the form later on, but I always get the error

"Du kannst die Seite \u0022-\u0022 nicht anlegen"

These methods (creating, deleting, updating etc.) need permissions, so you have to be either logged in to create the page, or you have to impersonate a user or authenticate as almighty:

$kirby->impersonate('kirby');

Thanks a lot!
This seems to work. Unfortunately, I am getting a CORB error though

Cross-Origin Read Blocking (CORB) blocked cross-origin 
response http://domain.com/form with MIME type text/html. 
See https://www.chromestatus.com/feature/5629709824032768 
for more details.

I’m using VUE for the frontend and Kirby as a headless CMS… The backend is on a subdomain.

I’ve already tried setting headers in my template

header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: PUT, GET, POST");
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");

Somehow, the page is created though. But I need a success response on my frontend.

Any ideas what I am doing wrong?