diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/react/App.jsx (renamed from src/client/react/App.js) | 0 | ||||
-rw-r--r-- | src/client/react/actions/search.js (renamed from src/client/react/actions.js) | 2 | ||||
-rw-r--r-- | src/client/react/components/container/Search.js | 6 | ||||
-rw-r--r-- | src/client/react/components/presentational/Search.jsx (renamed from src/client/react/components/presentational/Search.js) | 2 | ||||
-rw-r--r-- | src/client/react/index.jsx (renamed from src/client/react/index.js) | 0 | ||||
-rw-r--r-- | src/client/react/reducers.js | 25 | ||||
-rw-r--r-- | src/client/react/reducers/search.js | 21 | ||||
-rw-r--r-- | src/server/routes/getSchedule.js | 7 |
8 files changed, 38 insertions, 25 deletions
diff --git a/src/client/react/App.js b/src/client/react/App.jsx index d79826e..d79826e 100644 --- a/src/client/react/App.js +++ b/src/client/react/App.jsx diff --git a/src/client/react/actions.js b/src/client/react/actions/search.js index a754943..82db383 100644 --- a/src/client/react/actions.js +++ b/src/client/react/actions/search.js @@ -1,5 +1,5 @@ // eslint-disable-next-line import/prefer-default-export export const type = typedValue => ({ - type: 'TYPE', + type: 'SEARCH/TYPE', typedValue, }); diff --git a/src/client/react/components/container/Search.js b/src/client/react/components/container/Search.js index 0722128..ddfb0a6 100644 --- a/src/client/react/components/container/Search.js +++ b/src/client/react/components/container/Search.js @@ -1,10 +1,10 @@ import { connect } from 'react-redux'; -import { type } from '../../actions'; +import { type } from '../../actions/search'; import PresentationalSearch from '../presentational/Search'; const mapStateToProps = state => ({ - results: state.searchResults, - value: state.searchInput, + results: state.search.searchResults, + value: state.search.searchInput, }); const mapDispatchToProps = dispatch => ({ diff --git a/src/client/react/components/presentational/Search.js b/src/client/react/components/presentational/Search.jsx index f75e612..1e00192 100644 --- a/src/client/react/components/presentational/Search.js +++ b/src/client/react/components/presentational/Search.jsx @@ -16,7 +16,7 @@ const Search = ({ onType, value, results }) => ( Search.propTypes = { onType: PropTypes.func.isRequired, - value: PropTypes.func.isRequired, + value: PropTypes.string.isRequired, results: PropTypes.arrayOf(PropTypes.shape({ name: PropTypes.string.require, type: PropTypes.string.require, diff --git a/src/client/react/index.js b/src/client/react/index.jsx index e1bae3c..e1bae3c 100644 --- a/src/client/react/index.js +++ b/src/client/react/index.jsx diff --git a/src/client/react/reducers.js b/src/client/react/reducers.js index 3fb884b..9fdf2c4 100644 --- a/src/client/react/reducers.js +++ b/src/client/react/reducers.js @@ -1,21 +1,8 @@ -const DEFAULT_STATE = { - searchInput: '', - searchResults: [], -}; +import { combineReducers } from 'redux'; +import search from './reducers/search'; -const reducer = (state = DEFAULT_STATE, action) => { - switch (action.type) { - case 'TYPE': - return { - ...state, - searchInput: action.typedValue, - searchResults: [ - { type: 's', name: '18561' }, - ], - }; - default: - return state; - } -}; +const rootReducer = combineReducers({ + search, +}); -export default reducer; +export default rootReducer; diff --git a/src/client/react/reducers/search.js b/src/client/react/reducers/search.js new file mode 100644 index 0000000..05926c9 --- /dev/null +++ b/src/client/react/reducers/search.js @@ -0,0 +1,21 @@ +const DEFAULT_STATE = { + searchInput: '', + searchResults: [], +}; + +const search = (state = DEFAULT_STATE, action) => { + switch (action.type) { + case 'SEARCH/TYPE': + return { + ...state, + searchInput: action.typedValue, + searchResults: [ + { type: 's', name: '18561' }, + ], + }; + default: + return state; + } +}; + +export default search; diff --git a/src/server/routes/getSchedule.js b/src/server/routes/getSchedule.js index 7850918..9c31d66 100644 --- a/src/server/routes/getSchedule.js +++ b/src/server/routes/getSchedule.js @@ -67,7 +67,12 @@ router.get('/:type/:value', function (req, res, next) { return } - const utf8Body = iconv.decode(data.body, 'ISO-8859-1') + let utf8Body = iconv.decode(data.body, 'ISO-8859-1') + + users.forEach(function (user) { + let utf8Body = utf8Body.replace(/oko/g, "test") + }) + res.status(data.statusCode).end(utf8Body) }) }) |