Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
Desktop Client
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SpinShare
Desktop Client
Commits
a6707980
Commit
a6707980
authored
Jun 16, 2020
by
SpinShare
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added search timeout for less lag during search
parent
84e4bd32
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
15 deletions
+26
-15
src/views/Search.vue
src/views/Search.vue
+26
-15
No files found.
src/views/Search.vue
View file @
a6707980
...
...
@@ -50,7 +50,8 @@
searchQuery
:
""
,
searchResultsUsers
:
[],
searchResultsSongs
:
[],
apiFinished
:
false
apiFinished
:
false
,
searchTimeout
:
null
}
},
mounted
:
function
()
{
...
...
@@ -77,24 +78,34 @@
});
},
search
:
function
()
{
let
ssapi
=
new
SSAPI
(
process
.
env
.
NODE_ENV
===
'
development
'
);
this
.
$data
.
apiFinished
=
false
;
console
.
log
(
"
[SEARCH] Search Timeout Initiazed...
"
);
if
(
this
.
$data
.
searchQuery
!=
""
)
{
ssapi
.
search
(
this
.
$data
.
searchQuery
).
then
((
data
)
=>
{
if
(
data
.
status
==
200
)
{
this
.
$data
.
searchResultsUsers
=
data
.
data
.
users
;
this
.
$data
.
searchResultsSongs
=
data
.
data
.
songs
;
if
(
this
.
$data
.
searchTimeout
)
{
clearTimeout
(
this
.
$data
.
searchTimeout
);
}
this
.
$data
.
apiFinished
=
true
;
}
});
}
else
{
this
.
$data
.
searchResultsUsers
=
[];
this
.
$data
.
searchResultsSongs
=
[];
this
.
$data
.
searchTimeout
=
setTimeout
(()
=>
{
console
.
log
(
"
[SEARCH] Executing Search...
"
);
let
ssapi
=
new
SSAPI
(
process
.
env
.
NODE_ENV
===
'
development
'
);
this
.
$data
.
apiFinished
=
false
;
}
if
(
this
.
$data
.
searchQuery
!=
""
)
{
ssapi
.
search
(
this
.
$data
.
searchQuery
).
then
((
data
)
=>
{
if
(
data
.
status
==
200
)
{
this
.
$data
.
searchResultsUsers
=
data
.
data
.
users
;
this
.
$data
.
searchResultsSongs
=
data
.
data
.
songs
;
this
.
$data
.
apiFinished
=
true
;
}
});
}
else
{
this
.
$data
.
searchResultsUsers
=
[];
this
.
$data
.
searchResultsSongs
=
[];
this
.
$data
.
apiFinished
=
false
;
}
},
500
);
}
}
}
...
...
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