From 58e38fd488a0c98b4b7d4929ba9fe920ec8ffaa5 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Tue, 14 Dec 2021 07:59:11 +0100 Subject: [PATCH] Load common JS config for all requests --- application/core/EA_Controller.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/application/core/EA_Controller.php b/application/core/EA_Controller.php index a810273d..7d49bcd5 100644 --- a/application/core/EA_Controller.php +++ b/application/core/EA_Controller.php @@ -72,6 +72,8 @@ class EA_Controller extends CI_Controller { parent::__construct(); $this->configure_language(); + + $this->load_common_js_config(); } /** @@ -88,4 +90,16 @@ class EA_Controller extends CI_Controller { $this->lang->load('translations'); } + + /** + * Load common JS config for all requests. + */ + private function load_common_js_config() + { + js_config([ + 'base_url' => config('base_url'), + 'index_page' => config('index_page'), + 'csrf_token' => config('csrf_token'), + ]); + } }