From d863da26561ee6b44ceb3fb301c979a60f81de72 Mon Sep 17 00:00:00 2001 From: joschrew <91774427+joschrew@users.noreply.github.com> Date: Tue, 29 Oct 2024 16:46:23 +0100 Subject: [PATCH] Display errmsg when on search-detail without id --- src/pages/search-detail/index.vue | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/pages/search-detail/index.vue b/src/pages/search-detail/index.vue index 522db91..2d4e776 100644 --- a/src/pages/search-detail/index.vue +++ b/src/pages/search-detail/index.vue @@ -110,7 +110,7 @@ export default { error_msg: null, loading: true, response: null, - isUserLoggedIn: this, + isUserLoggedIn: false, listenerKey: -1, moveTriggered: false, }; @@ -198,9 +198,14 @@ export default { this.loading = false; } }, + async loadArchiveInfo() { - let response = await lzaApi.getArchiveInfo(this.id, 0, 0, false); - this.archiveInfo = response.data; + try { + let response = await lzaApi.getArchiveInfo(this.id, 0, 0, false); + this.archiveInfo = response.data; + } catch (error) { + this.archiveInfo = {} + } }, exportArchive() { @@ -277,8 +282,14 @@ export default { }, }, async created() { - await this.loadData(); - await this.loadArchiveInfo(); + if (!this.id) { + this.error = true; + this.error_msg = "PID is missing"; + this.loading = false; + } else { + await this.loadData(); + await this.loadArchiveInfo(); + } }, async unmounted() { authService.removeLoggedInListener(this.listenerKey);