diff options
author | Vitaly Takmazov | 2018-03-15 20:11:33 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:52 +0300 |
commit | 9d42f009bbf7c073d3a48bf65bb9b12775d68b3d (patch) | |
tree | 5a2f6faa73cc1915a167597631b73f6a0cbd67f9 /vnext/src/components/Discover.js | |
parent | a87c3fcaafc8c839ae1263f84502634ef61081ec (diff) |
LoginButton
Diffstat (limited to 'vnext/src/components/Discover.js')
-rw-r--r-- | vnext/src/components/Discover.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/vnext/src/components/Discover.js b/vnext/src/components/Discover.js index 2d962bda..7fde3d88 100644 --- a/vnext/src/components/Discover.js +++ b/vnext/src/components/Discover.js @@ -1,6 +1,7 @@ import "whatwg-fetch" import React from "react" import PropTypes from "prop-types" +import queryString from "query-string" import Message from "./Message" @@ -9,7 +10,8 @@ export default class Discover extends React.Component { super(props) this.state = { msgs: [], - loading: false + loading: false, + search: this.props.location.search } this.loadMessages = this.loadMessages.bind(this); } @@ -22,8 +24,7 @@ export default class Discover extends React.Component { } } loadMessages() { - const search = new URLSearchParams(this.props.params); - const url = "https://api.juick.com/messages"; + const url = "https://api.juick.com/messages" + this.state.search; fetch(url) .then(response => { return response.json() @@ -38,13 +39,13 @@ export default class Discover extends React.Component { render() { var nodes = this.state.msgs.map(msg => { return (<Message key={msg.mid} data={msg}/>) - }); + }); return ( - <div className="msgs" id="content">{nodes}</div> + <div className="msgs" id="content">{nodes}</div> ) } }; Discover.propTypes = { - msgs: PropTypes.array + msgs: PropTypes.array } |