Skip to content

Commit

Permalink
refactor bookmark.getAll
Browse files Browse the repository at this point in the history
  • Loading branch information
soltanireza65 committed Nov 28, 2023
1 parent 75dff1d commit 326effb
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions bookmarks/vanilla/src/modules/Bookmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,23 @@ export class Bookmark {
*/
public static async getAll(session: Session) {
const indexUrls = await this.getIndexUrl(session);
const all = indexUrls.map(async (indexUrl) => {
try {
try {
const all = indexUrls.map(async (indexUrl) => {
const ds = await getSolidDataset(indexUrl, { fetch: session.fetch });

const things = getThingAll(ds)

const bookmarks = await things.map(thing => this.mapBookmark(thing))

return bookmarks
} catch (error) {
return []
}
})
const allPromise = Promise.all([...all]);
const values = (await allPromise).flat();
return values;
})
const allPromise = Promise.all([...all]);
const values = (await allPromise).flat();
return values;
} catch (error) {
return []
}

}

/**
Expand Down

0 comments on commit 326effb

Please sign in to comment.