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); },