diff --git a/apps/edgecreator/src/pages/edit/[...all].vue b/apps/edgecreator/src/pages/edit/[...all].vue index 15ef3089f..0b495a981 100644 --- a/apps/edgecreator/src/pages/edit/[...all].vue +++ b/apps/edgecreator/src/pages/edit/[...all].vue @@ -1,10 +1,5 @@ @@ -138,11 +130,7 @@ - + (null); @@ -192,6 +180,18 @@ const dimensionsPerIssuecode = computed(() => ), ); +const getActualIssuecode = (issuecode: string) => { + const actualIssuecode = Object.values(issuecodeDetails.value).find( + ({ publicationcode: thisPublicationcode, issuenumber }) => thisPublicationcode === publicationcode.value && issuenumber === issuecode.split(/[ ]+/)[1], + )?.issuecode; + + if (actualIssuecode === undefined) { + throw new Error(`Issue ${issuecode} doesn't exist`); + } + + return actualIssuecode +} + const stepsPerIssuecode = computed(() => issuecodes.value.reduce>( (acc, issuecode) => ({ @@ -223,24 +223,26 @@ try { [firstIssuecode, ...otherIssuecodes] = firstIssuecode.split(","); } - await coaStore.fetchIssuecodeDetails([firstIssuecode]); + const issuecodeParts = firstIssuecode.split(/[ ]+/); - if (!firstIssuecode) { - throw new Error(`Issue ${firstIssuecode} doesn't exist`); - } + publicationcode.value = issuecodeParts[0]; await mainStore.loadPublicationIssues(); + debugger + + firstIssuecode = getActualIssuecode(firstIssuecode); + if (lastIssuecode) { + lastIssuecode = getActualIssuecode(lastIssuecode); + } + otherIssuecodes = otherIssuecodes?.map(issuecode => getActualIssuecode(issuecode)); try { - mainStore.setIssuecodes(firstIssuecode!, lastIssuecode, otherIssuecodes); + mainStore.setIssuecodes(firstIssuecode, lastIssuecode, otherIssuecodes); editingStepStore.addIssuecode(firstIssuecode!); for (const issuecode of issuecodes.value) { const idx = issuecodes.value.indexOf(issuecode); - if (!Object.prototype.hasOwnProperty.call(issuecodes, idx)) { - continue; - } try { await loadModel(firstIssuecode, issuecode); } catch { @@ -260,8 +262,8 @@ try { } catch (e) { error.value = e as string; } -} catch (_e) { - error.value = "Invalid URL"; +} catch (e) { + error.value = e as string; } const getImageUrl = (fileType: string, fileName: string) => diff --git a/apps/web/src/stores/collection.ts b/apps/web/src/stores/collection.ts index 9ca9a1b18..0e564b81e 100644 --- a/apps/web/src/stores/collection.ts +++ b/apps/web/src/stores/collection.ts @@ -348,7 +348,6 @@ export const collection = defineStore("collection", () => { role === "EdgeCreator" && privilege === thisPrivilege, ) || false; - console.log(issues.value); return { ...collectionUtils, issues,