Changed way to connect to api
This commit is contained in:
17
ui/common/Controller/Api.php
Normal file
17
ui/common/Controller/Api.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace ProVM\Common\Controller;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use ProVM\Common\Service\Api as Service;
|
||||
|
||||
class Api
|
||||
{
|
||||
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, Service $service): ResponseInterface
|
||||
{
|
||||
$body = $request->getBody();
|
||||
$json = \Safe\json_decode($body->getContents(), JSON_OBJECT_AS_ARRAY);
|
||||
|
||||
return $service->sendRequest($json);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user