Fixed CORS

This commit is contained in:
Frank Schubert
2022-11-08 18:44:21 +01:00
parent 7912faeb21
commit 86bfedc6ac

View File

@@ -48,13 +48,6 @@ class mfBaseApicontroller {
$this->init();
}
if($this->requireAuth) {
$this->authenticateUser();
if(method_exists($this,"authenticated")) {
$this->authenticated();
}
}
// Apicontroller should add allowed hostnames with $this->addAllowedOrigin()
$this->createCorsHeaders();
@@ -64,6 +57,15 @@ class mfBaseApicontroller {
$this->return(mfResponse::Ok());
}
if($this->requireAuth) {
$this->authenticateUser();
if(method_exists($this,"authenticated")) {
$this->authenticated();
}
}
// route to action
$this->route = $params['apicall'].((array_key_exists("apiparams", $params)) ? $params['apiparams'] : "");
$responseData = $this->runRoute($this->route);