From 24c8a1c50150038b0a184a1b5ffe1f41b667b090 Mon Sep 17 00:00:00 2001 From: chfhtw Date: Thu, 16 Apr 2026 09:51:32 +0200 Subject: [PATCH] Decode JSON in backend not frontend and make component path a full path (also in backend) --- .../controllers/api/frontend/v1/dashboard/Board.php | 10 ++++++++++ public/js/components/Dashboard/Admin.js | 3 --- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/application/controllers/api/frontend/v1/dashboard/Board.php b/application/controllers/api/frontend/v1/dashboard/Board.php index 2c8c72107..fdded61e3 100644 --- a/application/controllers/api/frontend/v1/dashboard/Board.php +++ b/application/controllers/api/frontend/v1/dashboard/Board.php @@ -55,6 +55,16 @@ class Board extends FHCAPI_Controller $data = $this->getDataOrTerminateWithError($result); + $data = array_map(function ($dashboard) { + $tmpSetups = json_decode($dashboard->widgetSetup); + $tmpSetups = array_map(function ($widget) { + $widget->setup->file = absoluteJsImportUrl($widget->setup->file); + return $widget; + }, $tmpSetups); + $dashboard->widgetSetup = $tmpSetups; + return $dashboard; + }, $data); + $this->terminateWithSuccess($data); } diff --git a/public/js/components/Dashboard/Admin.js b/public/js/components/Dashboard/Admin.js index 5222b9673..8921400b8 100644 --- a/public/js/components/Dashboard/Admin.js +++ b/public/js/components/Dashboard/Admin.js @@ -87,9 +87,6 @@ export default { .call(ApiDashboardBoard.list()) .then(result => { this.dashboards = result.data; - for (const dashboard of this.dashboards) { - dashboard.widgetSetup = JSON.parse(dashboard.widgetSetup); - } }) .catch(this.$fhcAlert.handleSystemError); },