-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1625063
commit ef22f2e
Showing
6 changed files
with
42 additions
and
8 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
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 |
---|---|---|
@@ -1,8 +1,18 @@ | ||
import type { AnyAction, State } from "./types" | ||
import { merge, uniq } from "lodash" | ||
|
||
const defaultState: State = {} | ||
const defaultState: State = { macs: [] } | ||
|
||
const reducer = (state = defaultState, action: AnyAction) => state | ||
const reducer = (state = defaultState, action: AnyAction) => { | ||
switch (action.type) { | ||
case "UPDATE_MACS": | ||
const newState: State = merge({}, state) | ||
newState.macs = uniq(newState.macs.concat(action.payload)) | ||
return newState | ||
default: | ||
return state | ||
} | ||
} | ||
|
||
export default reducer | ||
export { defaultState } |
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