-
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.
- Loading branch information
Showing
7 changed files
with
122 additions
and
79 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,21 @@ | ||
import { GET_GLOSSARYTERMS, GET_TOOLTIPTERMS } from '../constants/ActionTypes'; | ||
|
||
export function getGlossaryTerms() { | ||
return { | ||
type: GET_GLOSSARYTERMS, | ||
request: { | ||
op: 'get', | ||
path: '/@glossary_terms', | ||
}, | ||
}; | ||
} | ||
|
||
export function getTooltipTerms() { | ||
return { | ||
type: GET_TOOLTIPTERMS, | ||
request: { | ||
op: 'get', | ||
path: '/@tooltip_terms', | ||
}, | ||
}; | ||
} |
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,3 @@ | ||
import { getGlossaryTerms, getTooltipTerms } from './glossary'; | ||
|
||
export { getGlossaryTerms, getTooltipTerms }; |
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,2 @@ | ||
export const GET_GLOSSARYTERMS = 'GET_GLOSSARYTERMS'; | ||
export const GET_TOOLTIPTERMS = 'GET_TOOLTIPTERMS'; |
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,61 @@ | ||
import { GET_GLOSSARYTERMS, GET_TOOLTIPTERMS } from '../constants/ActionTypes'; | ||
|
||
const initialState = { | ||
error: null, | ||
hasErrror: false, | ||
result: [], | ||
loadingResults: false, | ||
}; | ||
|
||
export const glossarytermsReducer = (state = initialState, action = {}) => { | ||
switch (action.type) { | ||
case `${GET_GLOSSARYTERMS}_PENDING`: | ||
return { | ||
...state, | ||
loadingResults: true, | ||
}; | ||
case `${GET_GLOSSARYTERMS}_SUCCESS`: | ||
return { | ||
...state, | ||
result: action.result, | ||
loadingResults: false, | ||
}; | ||
case `${GET_GLOSSARYTERMS}_FAIL`: | ||
return { | ||
...state, | ||
error: action.error, | ||
hasError: true, | ||
loadingResults: false, | ||
}; | ||
default: | ||
return state; | ||
} | ||
}; | ||
|
||
export const glossarytooltiptermsReducer = ( | ||
state = initialState, | ||
action = {}, | ||
) => { | ||
switch (action.type) { | ||
case `${GET_TOOLTIPTERMS}_PENDING`: | ||
return { | ||
...state, | ||
loadingResults: true, | ||
}; | ||
case `${GET_TOOLTIPTERMS}_SUCCESS`: | ||
return { | ||
...state, | ||
result: action.result, | ||
loadingResults: false, | ||
}; | ||
case `${GET_TOOLTIPTERMS}_FAIL`: | ||
return { | ||
...state, | ||
error: action.error, | ||
hasError: true, | ||
loadingResults: false, | ||
}; | ||
default: | ||
return state; | ||
} | ||
}; |
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