fix(react): Add URL formats to Bookmarked Set picker
This commit is contained in:
parent
7f4c04308c
commit
c60f73befd
1 changed files with 7 additions and 2 deletions
|
@ -130,10 +130,15 @@ export const BookmarkedSetPicker = ({
|
||||||
const [status, body] = await backend.getBookmarks()
|
const [status, body] = await backend.getBookmarks()
|
||||||
const loadedSets = {}
|
const loadedSets = {}
|
||||||
if (status === 200 && body.result === 'success') {
|
if (status === 200 && body.result === 'success') {
|
||||||
|
const setsRE = /\/set(\?id=|s\/)(\d+)$/
|
||||||
|
const unique_ids = new Set()
|
||||||
for (const bookmark of body.bookmarks.filter((bookmark) => bookmark.type === 'set')) {
|
for (const bookmark of body.bookmarks.filter((bookmark) => bookmark.type === 'set')) {
|
||||||
let set
|
const match = bookmark.url.match(setsRE)
|
||||||
|
if (match) unique_ids.add(match[2])
|
||||||
|
}
|
||||||
|
for (const id of unique_ids) {
|
||||||
try {
|
try {
|
||||||
const [status, body] = await backend.getSet(bookmark.url.slice(6))
|
const [status, body] = await backend.getSet(id)
|
||||||
if (status === 200 && body.result === 'success') {
|
if (status === 200 && body.result === 'success') {
|
||||||
const [hasMeasies] = hasRequiredMeasurements(Design, body.set.measies)
|
const [hasMeasies] = hasRequiredMeasurements(Design, body.set.measies)
|
||||||
loadedSets[body.set.id] = { ...body.set, hasMeasies }
|
loadedSets[body.set.id] = { ...body.set, hasMeasies }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue