From e986fe03b58ae15f0ba307ed6c673f3eda402f00 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Tue, 21 May 2024 08:38:10 +0000
Subject: [PATCH] fixes #4195

Closes #4195

Merge request studip/studip!3026
---
 app/controllers/admin/cache.php               |  5 ++-
 .../vue/components/CacheAdministration.vue    | 34 +++++++++----------
 2 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/app/controllers/admin/cache.php b/app/controllers/admin/cache.php
index 3e9d970a76d..c016af5efd6 100644
--- a/app/controllers/admin/cache.php
+++ b/app/controllers/admin/cache.php
@@ -81,11 +81,10 @@ class Admin_CacheController extends AuthenticatedController
 
     /**
      * Fetches necessary configuration for given cache type.
-     *
-     * @param string $className
      */
-    public function get_config_action($className)
+    public function get_config_action()
     {
+        $className = Request::get('cache');
         $type = CacheType::findOneByClass_name($className);
 
         $this->render_json($type->class_name::getConfig());
diff --git a/resources/vue/components/CacheAdministration.vue b/resources/vue/components/CacheAdministration.vue
index af3d461f695..5da9568d415 100644
--- a/resources/vue/components/CacheAdministration.vue
+++ b/resources/vue/components/CacheAdministration.vue
@@ -82,24 +82,24 @@ export default {
          * @param event
          */
         getCacheConfig (event) {
-            fetch(STUDIP.URLHelper.getURL(`dispatch.php/admin/cache/get_config/${this.selectedCacheType}`))
-                .then((response) => {
-                    if (!response.ok) {
-                        throw response
-                    }
+            const url = STUDIP.URLHelper.getURL(
+                'dispatch.php/admin/cache/get_config',
+                {cache: this.selectedCacheType},
+                true
+            );
+            fetch(url).then((response) => {
+                if (!response.ok) {
+                    throw response
+                }
 
-                    response.json()
-                        .then((json) => {
-                            this.configComponent = json.component
-                            this.configProps = json.props
-                        }).catch((error) => {
-                            console.error(error)
-                            console.error(error.status + ': ', error.statusText)
-                        })
-                }).catch((error) => {
-                    console.error(error)
-                    console.error(error.status + ': ', error.statusText)
-                })
+                response.json().then((json) => {
+                    this.configComponent = json.component
+                    this.configProps = json.props
+                });
+            }).catch((error) => {
+                console.error(error)
+                console.error(error.status + ': ', error.statusText)
+            })
         },
         validateConfig () {
             if (this.configComponent == null || this.isValid) {
-- 
GitLab