Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
f05b1b05
Commit
f05b1b05
authored
May 14, 2019
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use async/await to simplify the first part of the load() method
parent
06209ef5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
61 deletions
+58
-61
groups.js
src/sidebar/services/groups.js
+58
-61
No files found.
src/sidebar/services/groups.js
View file @
f05b1b05
...
...
@@ -163,10 +163,12 @@ function groups(
*
* @return {Promise<Group[]>}
*/
function
load
()
{
let
uri
=
Promise
.
resolve
(
null
);
async
function
load
()
{
// Step 1: Get the URI of the active document, so we can fetch groups
// associated with that document.
let
uri
=
null
;
if
(
isSidebar
)
{
uri
=
getDocumentUriForGroupSearch
();
uri
=
await
getDocumentUriForGroupSearch
();
}
const
directLinkedGroupId
=
store
.
getState
().
directLinkedGroupId
;
const
directLinkedAnnId
=
store
.
getState
().
directLinkedAnnotationId
;
...
...
@@ -176,10 +178,6 @@ function groups(
let
directLinkedAnnotationGroupId
=
null
;
// Step 1: Get the URI of the active document, so we can fetch groups
// associated with that document.
return
uri
.
then
(
uri
=>
{
// Step 2: Concurrently fetch the groups the user is a member of,
// the groups associated with the current document and the annotation
// or group that was direct-linked (if any).
...
...
@@ -235,8 +233,7 @@ function groups(
});
}
groupApiRequests
=
groupApiRequests
.
concat
(
directLinkedGroupApi
);
return
Promise
.
all
(
groupApiRequests
);
})
return
Promise
.
all
(
groupApiRequests
)
.
then
(
([
myGroups
,
...
...
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