From 8cf4153d99c6364bae491cc2c14171bccf5a0e04 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Wed, 5 Apr 2023 14:27:03 +0200
Subject: [PATCH] Bug 33408: We need only one this.loaded call

---
 .../prog/js/vue/components/ERM/Main.vue            | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue
index 5c97cda1272..a54c2285136 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue
+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue
@@ -1,5 +1,5 @@
 <template>
-    <div v-if="initialized">
+    <div v-if="initialized && ERMModule == 1">
         <div id="sub-header">
             <Breadcrumb />
             <Help />
@@ -214,10 +214,7 @@ export default {
                     error => {}
                 )
             )
-            return Promise.all(promises).then(values => {
-                this.loaded()
-                this.initialized = true
-            })
+            return Promise.all(promises)
         }
 
         const sysprefs_client = APIClient.sysprefs
@@ -225,8 +222,7 @@ export default {
             .get("ERMModule")
             .then(value => {
                 this.ERMModule = value.value
-                if (this.ERMModule == 0) {
-                    this.loaded()
+                if (this.ERMModule != 1) {
                     return this.setError(
                         this.$__(
                             'The e-resource management module is disabled, turn on <a href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ERMModule">ERMModule</a> to use it'
@@ -236,6 +232,10 @@ export default {
                 }
                 return fetch_config()
             })
+            .then(() => {
+                this.loaded()
+                this.initialized = true
+            })
     },
     components: {
         Breadcrumb,
-- 
2.25.1