Commit 41a89680 authored by DevOps's avatar DevOps

Добавил обработку запроса для данных сайта

parent a1406d4e
......@@ -21,7 +21,7 @@ return [
$acl->deny(null, null)
->allow(Roles::ROLE_GUEST, 'home');
$acl->allow(Roles::ROLE_GUEST, 'test-react')
$acl->allow(Roles::ROLE_GUEST, 'get-site-data')
;
return $acl;
......
......@@ -15,8 +15,8 @@ return [
$container
);
},
App\Action\TestReact::class => function (ContainerInterface $container) {
return new \App\Action\TestReact(
App\Action\SiteData::class => function (ContainerInterface $container) {
return new \App\Action\SiteData(
$container->get(\Zend\Expressive\Router\RouterInterface::class),
$container->get(\Zend\Expressive\Template\TemplateRendererInterface::class),
$container
......@@ -37,10 +37,10 @@ return [
],
],
[
'name' => 'test-react',
'path' => '/test-react/',
'middleware' => App\Action\TestReact::class,
'allowed_methods' => ['POST', 'GET'],
'name' => 'get-site-data',
'path' => '/get-site-data/',
'middleware' => App\Action\SiteData::class,
'allowed_methods' => ['POST'],
'options' => [
'constraints' => [],
'defaults' => []
......
......@@ -11,7 +11,7 @@ class SiteForm extends React.Component {
};
};
componentDidMount = () => {
fetch("/test-react/", {method: 'POST'})
fetch("/get-site-data/", {method: 'POST'})
.then(res => res.json())
.then(
(result) => {
......@@ -45,7 +45,7 @@ class SiteForm extends React.Component {
return <div>Loading...</div>;
} else {
return (
<form id="site-form" method="POST" action="/test-react">
<form id="site-form" method="POST" action="/get-site-data/">
<div className="form-group-data marker">
<ConnectedService />
<ConnectedSlots />
......
......@@ -11,10 +11,10 @@ use Zend\Diactoros\Response\JsonResponse;
/**
* Class TestReact
* Class SiteData
* @package App\Action\Admin
*/
class TestReact extends Common
class SiteData extends Common
{
/**
......@@ -28,20 +28,19 @@ class TestReact extends Common
if ($request->getMethod() == 'POST')
{
$action = $request->getAttribute('action');
return $this->getTestData();
return $this->getTestSiteData();
}
/*
else
{
$response = new HtmlResponse($this->template->render('app::react/testredux', [
{
return new HtmlResponse($this->template->render('app::react/testredux', [
'layout' => 'empty',
]));
return $response;
}
*/
}
private function getTestData()
private function getTestSiteData()
{
$data = array(
'onlyNative' => true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment