-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
built action creator and reducer for header and update header type
- Loading branch information
1 parent
f245ce8
commit baf8c93
Showing
4 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { UPDATE_HEADER } from './types'; | ||
|
||
export function updateHeader(title, subtitle, hideBar) { | ||
return { | ||
type: UPDATE_HEADER, | ||
payload: {title, subtitle, hideBar} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { UPDATE_HEADER } from '../actions/types'; | ||
|
||
const INITIAL_STATE = { | ||
title: '', | ||
subtitle: '', | ||
hideBar: false | ||
} | ||
|
||
export default function(state = INITIAL_STATE, action) { | ||
switch (key) { | ||
case UPDATE_HEADER: | ||
const { title, subtitle, hideBar } = action.payload; | ||
return { | ||
...state, | ||
title, | ||
subtitle, | ||
hideBar | ||
} | ||
// return { | ||
// ...state, | ||
// ...action.payload | ||
// } | ||
default: return state; | ||
} | ||
} |