diff --git a/lib/Db/Attachment.php b/lib/Db/Attachment.php index ed1c2847..d06d4c0c 100644 --- a/lib/Db/Attachment.php +++ b/lib/Db/Attachment.php @@ -96,8 +96,8 @@ public function jsonSerialize(): array 'hash' => $this->hash, 'anonymization' => $this->anonymization, 'language' => $this->language, - 'modified' => $this->modified->format('c'), - 'published' => $this->published->format('c'), + 'modified' => $this->modified?->format('c'), + 'published' => $this->published?->format('c'), 'license' => $this->license, ]; diff --git a/lib/Db/Listing.php b/lib/Db/Listing.php index aac47c79..503c6d30 100644 --- a/lib/Db/Listing.php +++ b/lib/Db/Listing.php @@ -80,7 +80,7 @@ public function jsonSerialize(): array 'metadata' => $this->metadata, 'catalogId' => $this->catalogId, 'status' => $this->status, - 'lastSync' => $this->lastSync->format('c'), + 'lastSync' => $this->lastSync?->format('c'), 'default' => $this->default, 'available' => $this->available, 'organisation'=> json_decode($this->organisation, true), diff --git a/src/store/modules/publication.js b/src/store/modules/publication.js index cf64cf39..e8edfea7 100644 --- a/src/store/modules/publication.js +++ b/src/store/modules/publication.js @@ -74,9 +74,9 @@ export const usePublicationStore = defineStore( }, ) }, - getPublicationAttachments(publication) { // @todo this might belong in a service? + getPublicationAttachments(publicationId) { fetch( - '/index.php/apps/opencatalogi/api/attachments', + `/index.php/apps/opencatalogi/api/publications/${publicationId}/attachments`, { method: 'GET', }, @@ -187,9 +187,9 @@ export const usePublicationStore = defineStore( }) }, /* istanbul ignore next */ // ignore this for Jest until moved into a service - getPublicationAttachments(publication) { // @todo this might belong in a service? + getPublicationAttachments(publicationId) { fetch( - '/index.php/apps/opencatalogi/api/attachments', + '/index.php/apps/opencatalogi/api/publications/' + publicationId + '/attachments', { method: 'GET', }, diff --git a/src/views/publications/PublicationDetail.vue b/src/views/publications/PublicationDetail.vue index de33872a..83c99954 100644 --- a/src/views/publications/PublicationDetail.vue +++ b/src/views/publications/PublicationDetail.vue @@ -477,7 +477,7 @@ export default { // this.oldZaakId = id this.fetchCatalogi(data.catalogi?.id) this.fetchMetaData(data.metaData?.id) - publicationStore.getPublicationAttachments() + publicationStore.getPublicationAttachments(id) // this.loading = false }) })