Skip to content

Commit

Permalink
refactor: display side bar even if error
Browse files Browse the repository at this point in the history
  • Loading branch information
rwd committed Nov 4, 2024
1 parent 5a3426a commit 52b6be2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
26 changes: 12 additions & 14 deletions packages/portal/src/components/item/ItemMediaPresentation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
ref="viewerWrapper"
class="iiif-viewer-wrapper overflow-hidden"
>
<IIIFErrorMessage
v-if="$fetchState.error"
:provider-url="providerUrl"
/>
<b-container
v-else-if="$fetchState.pending"
v-if="$fetchState.pending"
data-qa="loading spinner container"
>
<b-row class="flex-md-row py-4 text-center">
Expand All @@ -23,8 +19,12 @@
<div
class="iiif-viewer-inner-wrapper w-100 overflow-auto"
>
<IIIFErrorMessage
v-if="$fetchState.error"
:provider-url="providerUrl"
/>
<ItemMediaSidebar
v-if="sidebarHasContent"
v-else-if="sidebarHasContent"
v-show="showSidebar"
ref="sidebar"
tabindex="0"
Expand All @@ -34,7 +34,7 @@
@keydown.escape.native="showSidebar = false"
/>
<MediaImageViewer
v-if="imageTypeResource"
v-else-if="imageTypeResource"
:url="resource.id"
:item-id="itemId"
:width="resource.width"
Expand Down Expand Up @@ -240,11 +240,13 @@
await this.fetchPresentation(this.uri);
} else if (this.webResources) {
this.setPresentationFromWebResources(this.webResources);
} else {
throw new Error('No manifest URI or web resources for presentation');
}
this.selectResource();
if (!this.resource) {
throw new Error('No resource to present.');
}
},
computed: {
Expand Down Expand Up @@ -279,11 +281,7 @@
},
handleMediaRendererError(error) {
if (error.isAxiosError) {
this.$fetchState.error = error;
} else {
// else what?
}
this.$fetchState.error = error;
},
selectResource() {
Expand Down
2 changes: 0 additions & 2 deletions packages/portal/src/components/media/MediaImageViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@
async fetch() {
try {
if (this.service?.id) {
// TODO: mv info retrieval into the itemMediaPresentation composable?
// e.g. for centralised error handling
const infoResponse = await this.service.fetchInfo();
this.info = infoResponse.data;
this.source = 'IIIF';
Expand Down

0 comments on commit 52b6be2

Please sign in to comment.