Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
addcpm-json
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Александр Чаплыгин
addcpm-json
Commits
41a89680
Commit
41a89680
authored
May 14, 2018
by
DevOps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил обработку запроса для данных сайта
parent
a1406d4e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
18 deletions
+17
-18
acl.global.php
src/config/autoload/acl.global.php
+1
-1
routes.global.php
src/config/autoload/routes.global.php
+6
-6
site-form.js
src/public/js/react/site/containers/site-form.js
+2
-2
SiteData.php
src/src/App/Action/SiteData.php
+8
-9
No files found.
src/config/autoload/acl.global.php
View file @
41a89680
...
...
@@ -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
;
...
...
src/config/autoload/routes.global.php
View file @
41a89680
...
...
@@ -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'
=>
[]
...
...
src/public/js/react/site/containers/site-form.js
View file @
41a89680
...
...
@@ -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
/>
...
...
src/src/App/Action/
TestReact
.php
→
src/src/App/Action/
SiteData
.php
View file @
41a89680
...
...
@@ -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
->
getTest
Site
Data
();
}
/*
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
getTest
Site
Data
()
{
$data
=
array
(
'onlyNative'
=>
true
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment