Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
7b15ef23
Commit
7b15ef23
authored
Jan 29, 2018
by
chrisgarrity
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle search queries
parent
404dc4b0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
src/views/search/search.jsx
src/views/search/search.jsx
+4
-3
No files found.
src/views/search/search.jsx
View file @
7b15ef23
...
...
@@ -29,6 +29,7 @@ class Search extends React.Component {
this
.
state
=
this
.
getSearchState
();
this
.
state
.
loaded
=
[];
this
.
state
.
loadNumber
=
16
;
this
.
state
.
offset
=
0
;
}
componentDidMount
()
{
const
query
=
window
.
location
.
search
;
...
...
@@ -48,7 +49,7 @@ class Search extends React.Component {
}
componentDidUpdate
(
prevProps
)
{
if
(
this
.
props
.
searchTerm
!==
prevProps
.
searchTerm
)
{
this
.
g
etSearchMore
();
this
.
handleG
etSearchMore
();
}
}
getSearchState
()
{
...
...
@@ -69,12 +70,12 @@ class Search extends React.Component {
termText
=
`&q=
${
encodeURIComponent
(
this
.
props
.
searchTerm
.
split
(
'
'
).
join
(
'
+
'
))}
`
;
}
const
locale
=
this
.
props
.
intl
.
locale
;
const
loadNumber
=
this
.
props
.
loadNumber
;
const
loadNumber
=
this
.
state
.
loadNumber
;
const
offset
=
this
.
state
.
offset
;
const
queryString
=
`limit=
${
loadNumber
}
&offset=
${
offset
}
&language=
${
locale
}
&mode=popular
${
termText
}
`
;
api
({
uri
:
`/search/
${
this
.
props
.
tab
}
?
${
queryString
}
`
uri
:
`/search/
${
this
.
state
.
tab
}
?
${
queryString
}
`
},
(
err
,
body
)
=>
{
const
loadedSoFar
=
this
.
state
.
loaded
;
Array
.
prototype
.
push
.
apply
(
loadedSoFar
,
body
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment