Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
hfpp2012
/
react-spd
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 65ded2ee
authored
Jun 09, 2017
by
hfpp2012 yinsigan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
完成saga
1 parent
18613311
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
2 deletions
src/actions/header.js
src/components/Header.js
src/constants/ActionTypes.js
src/reducers/header.js
src/actions/header.js
View file @
65ded2e
...
@@ -3,3 +3,8 @@ import * as types from '../constants/ActionTypes'
...
@@ -3,3 +3,8 @@ import * as types from '../constants/ActionTypes'
export
const
getHeader
=
()
=>
({
export
const
getHeader
=
()
=>
({
type
:
types
.
HEADER_FETCH_REQUESTED
type
:
types
.
HEADER_FETCH_REQUESTED
})
})
export
const
addRepo
=
(
repo
)
=>
({
type
:
types
.
ADD_REPO
,
repo
})
src/components/Header.js
View file @
65ded2e
...
@@ -49,7 +49,7 @@ class Header extends React.Component {
...
@@ -49,7 +49,7 @@ class Header extends React.Component {
return
(
return
(
<
div
className
=
"text-left top-header"
>
<
div
className
=
"text-left top-header"
>
<
ModalRepoForm
handleNewRepo
=
{
thi
s
.
addRepo
}
/
>
<
ModalRepoForm
handleNewRepo
=
{
action
s
.
addRepo
}
/
>
<
div
className
=
'col-md-10'
>
<
div
className
=
'col-md-10'
>
{
result
}
{
result
}
<
/div
>
<
/div
>
...
...
src/constants/ActionTypes.js
View file @
65ded2e
...
@@ -7,3 +7,4 @@ export const DELETE_ELEMENT = 'DELETE_ELEMENT'
...
@@ -7,3 +7,4 @@ export const DELETE_ELEMENT = 'DELETE_ELEMENT'
export
const
HEADER_FETCH_REQUESTED
=
'HEADER_FETCH_REQUESTED'
export
const
HEADER_FETCH_REQUESTED
=
'HEADER_FETCH_REQUESTED'
export
const
HEADER_FETCH_SUCCEEDED
=
'HEADER_FETCH_SUCCEEDED'
export
const
HEADER_FETCH_SUCCEEDED
=
'HEADER_FETCH_SUCCEEDED'
export
const
HEADER_FETCH_FAILED
=
'HEADER_FETCH_FAILED'
export
const
HEADER_FETCH_FAILED
=
'HEADER_FETCH_FAILED'
export
const
ADD_REPO
=
'ADD_REPO'
src/reducers/header.js
View file @
65ded2e
import
{
HEADER_FETCH_REQUESTED
,
HEADER_FETCH_SUCCEEDED
,
HEADER_FETCH_FAILED
}
from
'../constants/ActionTypes'
import
{
HEADER_FETCH_REQUESTED
,
HEADER_FETCH_SUCCEEDED
,
HEADER_FETCH_FAILED
,
ADD_REPO
}
from
'../constants/ActionTypes'
const
header
=
(
state
=
{},
action
)
=>
{
const
header
=
(
state
=
{},
action
)
=>
{
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
...
@@ -18,6 +18,15 @@ const header = (state = {}, action) => {
...
@@ -18,6 +18,15 @@ const header = (state = {}, action) => {
error_message
:
action
.
message
,
error_message
:
action
.
message
,
headers
:
[]
headers
:
[]
}
}
case
ADD_REPO
:
return
{
isFetching
:
false
,
error_message
:
null
,
headers
:
[
...
state
.
headers
,
action
.
repo
]
}
default
:
default
:
return
state
return
state
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment