@dr.pogodin/react-utils
Version:
Collection of generic ReactJS components and utils
17 lines (15 loc) • 772 B
JavaScript
/* global document */
import { parse } from 'cookie';
import clientGetInj from "../../client/getInj.js";
import { IS_CLIENT_SIDE } from "./isomorphy/environment-check.js";
import { requireWeak } from "./webpack.js"; // TODO: The internal type casting is somewhat messed up here,
// to be corrected later.
const config = (IS_CLIENT_SIDE ? clientGetInj().CONFIG : requireWeak('config')) ?? {};
// The safeguard for "document" is necessary because in non-Node environments,
// like React Native, IS_CLIENT_SIDE is "true", however "document" and a bunch
// of other browser-world features are not available.
if (IS_CLIENT_SIDE && typeof document !== 'undefined') {
config.CSRF = parse(document.cookie).csrfToken;
}
export default config;
//# sourceMappingURL=config.js.map