util.js 603 Bytes
import axios from 'axios';
import env from '../config/env';

let util = {

};

util.title = function(title) {
    title = title ? title + ' - Home' : 'iView project';
    window.document.title = title;
};

const ajaxUrl = env === 'development' ?
    '/' :
    env === 'production' ?
    'https://www.url.com' :
    'https://debug.url.com';

util.ajax = axios.create({
    baseURL: ajaxUrl,
    timeout: 30000
});

function getQueryString(name) {
    let urlParams = new URLSearchParams(window.location.search);
    return urlParams.get(name)
}

util.getQueryString = getQueryString

export default util;