diff options
author | 2018-11-11 15:29:45 +0300 | |
---|---|---|
committer | 2023-01-13 10:37:53 +0300 | |
commit | 9f1dd954d7023c6a121659d1299fb83fc117a66d (patch) | |
tree | 997663acf0ce16715728371bdf7ec4a139fcc139 /vnext/src | |
parent | 5f13cdc450dadd5708c8311880ebe9d451ae8989 (diff) |
Fix qs.parse calls
Diffstat (limited to 'vnext/src')
-rw-r--r-- | vnext/src/App.js | 2 | ||||
-rw-r--r-- | vnext/src/components/Feeds.js | 10 | ||||
-rw-r--r-- | vnext/src/components/Post.js | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/vnext/src/App.js b/vnext/src/App.js index 9c6e3a54..d4e3acfe 100644 --- a/vnext/src/App.js +++ b/vnext/src/App.js @@ -22,7 +22,7 @@ import { me } from './api'; export default class App extends React.Component { constructor(props) { super(props); - let params = qs.parse(window.location.search); + let params = qs.parse(window.location.search.substring(1)); if (params.hash) { cookies.save('hash', params.hash, { path: '/' }); window.history.replaceState({}, document.title, `${window.location.protocol}//${window.location.host}${window.location.pathname}`); diff --git a/vnext/src/components/Feeds.js b/vnext/src/components/Feeds.js index 27d1c074..be9a1573 100644 --- a/vnext/src/components/Feeds.js +++ b/vnext/src/components/Feeds.js @@ -14,7 +14,7 @@ import { getMessages } from '../api'; import { UserType } from './Types'; export function Discover(props) { - let search = qs.parse(props.location.search); + let search = qs.parse(props.location.search.substring(1)); const query = { baseUrl: '/messages', search: search, @@ -33,7 +33,7 @@ export function Discussions(props) { export function Blog(props) { const { user } = props.match.params; - let search = qs.parse(props.location.search); + let search = qs.parse(props.location.search.substring(1)); search.uname = user; const query = { baseUrl: '/messages', @@ -77,7 +77,7 @@ class Feed extends React.Component { }; } componentDidMount() { - this.loadMessages(this.props.visitor.hash, this.props.location.search); + this.loadMessages(this.props.visitor.hash, this.props.location.search.substring(1)); } shouldComponentUpdate(nextProps, nextState) { @@ -91,7 +91,7 @@ class Feed extends React.Component { } componentDidUpdate(prevProps, prevState, shouldReload) { if (shouldReload) { - this.loadMessages(this.props.visitor.hash, this.props.location.search); + this.loadMessages(this.props.visitor.hash, this.props.location.search.substring(1)); } } loadMessages = (hash = '', filter = '') => { @@ -127,7 +127,7 @@ class Feed extends React.Component { } render() { - const { tag } = qs.parse(this.props.location.search || {}); + const { tag } = qs.parse(this.props.location.search.substring(1) || {}); const nodes = ( <> { diff --git a/vnext/src/components/Post.js b/vnext/src/components/Post.js index 555ad9af..ce64018a 100644 --- a/vnext/src/components/Post.js +++ b/vnext/src/components/Post.js @@ -12,7 +12,7 @@ import { post } from '../api'; export default class Post extends React.Component { constructor(props) { super(props); - let params = qs.parse(window.location.search); + let params = qs.parse(window.location.search.substring(1)); this.state = { attach: '', body: params.body || '' |