diff options
Diffstat (limited to 'vnext/src/components/Feeds.js')
-rw-r--r-- | vnext/src/components/Feeds.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/vnext/src/components/Feeds.js b/vnext/src/components/Feeds.js index b70720ac..cf593b5e 100644 --- a/vnext/src/components/Feeds.js +++ b/vnext/src/components/Feeds.js @@ -6,11 +6,16 @@ import Message from './Message'; import Spinner from './Spinner'; export function Discover(props) { - return (<Feed baseUrl="https://api.juick.com/messages" {...props} />) + return (<Feed query={{ baseUrl: "https://api.juick.com/messages"}} {...props} />) } export function Discussions(props) { - return (<Feed authRequired="true" baseUrl="https://api.juick.com/messages/discussions" {...props} />) + return (<Feed authRequired="true" query={{ baseUrl: "https://api.juick.com/messages/discussions"}} {...props} />) +} + +export function Blog(props) { + const { user } = props.match.params; + return (<Feed query={{ baseUrl: `https://api.juick.com/messages`, search: { uname: user }}} {...props} />) } class Feed extends React.Component { @@ -34,8 +39,8 @@ class Feed extends React.Component { } loadMessages(hash = '', filter = '') { this.setState({ msgs: [] }) - let params = qs.parse(filter) || {} - let url = this.props.baseUrl; + let params = Object.assign({}, qs.parse(filter) || {}, this.props.query.search || {}); + let url = this.props.query.baseUrl; if (hash) { params.hash = hash; } @@ -68,5 +73,8 @@ class Feed extends React.Component { Feed.propTypes = { msgs: PropTypes.array, - baseUrl: PropTypes.string + query: PropTypes.shape({ + baseUrl: PropTypes.string.isRequired, + search: PropTypes.array + }) }; |