HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/stielman.komma.nl/vendor/komma/kms/resources/js/global/configService.js
import { axios } from './axiosBootstrapper'

/**
 * ConfigService
 *
 * Connects to laravel's config() helper
 */
class ConfigService {
    constructor()
    {
        this.baseRoute = '/globalisation/config/';
    }

    /**
     * Returns a promise which resolves into a response with your config data.
     *
     * @param {string} key
     */
    async get(key) {
        let result = '';
        await axios.post(this.baseRoute+'get', {'key': key}).then((response) => {
            result = response.data;
        }).catch((error) => {
            console.error('Could not get config key: '+key+'. Because of this error: ', error);
        });

        return result;
    }
}

export { ConfigService }