From 9f1dd954d7023c6a121659d1299fb83fc117a66d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 11 Nov 2018 15:29:45 +0300 Subject: Fix qs.parse calls --- vnext/src/App.js | 2 +- vnext/src/components/Feeds.js | 10 +++++----- vnext/src/components/Post.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'vnext/src') 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 || '' -- cgit v1.2.3