Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Mobile
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
145
Issues
145
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Minds
Minds Mobile
Commits
8bdcbde9
Commit
8bdcbde9
authored
6 days ago
by
Martin Santangelo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat) infinite scroll feed service
parent
78c2b7d4
feat/infinite-scroll-feed-service
1 merge request
!290
[Sprint/KiltedKoala] (feat) infinite scroll feed service
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
feeds.service.js
src/common/services/feeds.service.js
+22
-2
No files found.
src/common/services/feeds.service.js
View file @
8bdcbde9
...
...
@@ -44,11 +44,26 @@ export default class FeedsService {
*/
feed
=
[];
/**
* @var {string}
*/
pagingToken
:
string
=
''
;
/**
* @var {boolean}
*/
endReached
=
false
;
/**
* Get entities from the current page
*/
async
getEntities
()
{
const
end
=
this
.
limit
+
this
.
offset
;
if
(
end
>
this
.
feed
.
length
&&
!
this
.
endReached
)
{
await
this
.
fetch
();
}
const
feedPage
=
this
.
feed
.
slice
(
this
.
offset
,
this
.
limit
+
this
.
offset
);
return
await
entitiesService
.
getFromFeed
(
feedPage
,
this
,
this
.
asActivities
);
}
...
...
@@ -150,9 +165,14 @@ export default class FeedsService {
*/
async
fetch
()
{
abort
(
this
);
const
response
=
await
apiService
.
get
(
this
.
endpoint
,
{...
this
.
params
,
...{
limit
:
150
,
as_activities
:
this
.
asActivities
?
1
:
0
}},
this
);
const
response
=
await
apiService
.
get
(
this
.
endpoint
,
{...
this
.
params
,
...{
limit
:
150
,
as_activities
:
this
.
asActivities
?
1
:
0
,
from_timestamp
:
this
.
pagingToken
}},
this
);
this
.
feed
=
response
.
entities
;
if
(
response
.
entities
.
length
)
{
this
.
feed
=
this
.
feed
.
concat
(
response
.
entities
);
this
.
pagingToken
=
response
[
'
load-next
'
];
}
else
{
this
.
endReached
=
true
;
}
// save without wait
feedsStorage
.
save
(
this
);
...
...
This diff is collapsed.
Click to expand it.
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