Move Phrasen API

This commit is contained in:
cgfhtw
2024-03-06 13:02:34 +01:00
parent e89aa824d2
commit 872ef7c31c
3 changed files with 31 additions and 4 deletions
@@ -0,0 +1,27 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
*/
class Phrasen extends FHC_Controller
{
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* @param string $module
*/
public function loadModule($module)
{
$this->load->library('PhrasesLib', [$module], 'pj');
$this->outputJson([
'data' => json_decode($this->pj->getJSON()),
'meta' => [
'status' => FHCAPI_Controller::STATUS_SUCCESS
]
]);
}
}
@@ -3,7 +3,7 @@
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
* TODO(chris): depricated
*/
class Phrasen extends FHC_Controller
{
+3 -3
View File
@@ -24,10 +24,10 @@ const phrasen = {
return Promise.all(category.map(cat => this.loadCategory(cat)));
if (!loadingModules[category])
loadingModules[category] = axios
.get(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/components/Phrasen/loadModule/' + category)
.get(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/api/frontend/v1/phrasen/loadModule/' + category)
.then(res => {
if (res.data.retval)
categories[category] = extractCategory(res.data.retval, category);
if (res?.data?.data)
categories[category] = extractCategory(res.data.data, category);
else
categories[category] = {};
});