Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import SingleObjectResource, {setConfig} from 'tg-resources';
import logger from '../logger';
import CurrentUserActions from '../actions/CurrentUserActions';
import {getExtraHeaders, getCookies} from './headers';
// Configure tg-resources
logger.debug('Configuring tg-resources');
setConfig('API_BASE', DJ_CONST.API_BASE);
setConfig('onSourceError', CurrentUserActions.pageFault);
setConfig('getExtraHeaders', getExtraHeaders);
setConfig('getCookies', getCookies);
export default SingleObjectResource;
export {InvalidResponseCode, ValidatonError} from 'tg-resources';
import SingleObjectResource, {setConfig} from 'tg-resources';
import logger from '../logger';
import CurrentUserActions from '../actions/CurrentUserActions';
import {getExtraHeaders, getCookies} from './headers';
// Configure tg-resources
logger.debug('Configuring tg-resources');
setConfig('API_BASE', DJ_CONST.API_BASE);
setConfig('onSourceError', CurrentUserActions.pageFault);
setConfig('getExtraHeaders', getExtraHeaders);
setConfig('getCookies', getCookies);
export default SingleObjectResource;
export {InvalidResponseCode, ValidatonError} from 'tg-resources';
import SingleObjectResource, {setConfig} from 'tg-resources';
import logger from '../logger';
import CurrentUserActions from '../actions/CurrentUserActions';
import {getExtraHeaders, getCookies} from './headers';
// Configure tg-resources
logger.debug('Configuring tg-resources');
setConfig('API_BASE', DJ_CONST.API_BASE);
setConfig('onSourceError', CurrentUserActions.pageFault);
setConfig('getExtraHeaders', getExtraHeaders);
setConfig('getCookies', getCookies);
export default SingleObjectResource;
export {InvalidResponseCode, ValidatonError} from 'tg-resources';
import SingleObjectResource, {setConfig} from 'tg-resources';
import logger from '../logger';
import CurrentUserActions from '../actions/CurrentUserActions';
import {getExtraHeaders, getCookies} from './headers';
// Configure tg-resources
logger.debug('Configuring tg-resources');
setConfig('API_BASE', DJ_CONST.API_BASE);
setConfig('onSourceError', CurrentUserActions.pageFault);
setConfig('getExtraHeaders', getExtraHeaders);
setConfig('getCookies', getCookies);
export default SingleObjectResource;
export {InvalidResponseCode, ValidatonError} from 'tg-resources';
import Router, {Resource} from 'tg-resources';
import {getCookie} from 'utils/cookie';
const resources = Object.entries(DJ_CONST.API || {})
.filter(item => item[0] !== 'apiRoot')
.reduce((result, [key, url]) => {
result[key] = new Resource(url); // eslint-disable-line no-param-reassign
return result;
}, {});
const api = new Router(
resources,
{
apiRoot: DJ_CONST.API_BASE,
headers: () => ({
Accept: 'application/json',
'X-CSRFToken': getCookie('csrftoken'),
}),
withCredentials: true,
},
);
export default api;
.reduce((result, [key, url]) => {
result[key] = new Resource(url); // eslint-disable-line no-param-reassign
return result;
}, {});