import { assert } from 'talon/utils';

/**
 * The currently live CSRF token on the framework
 */
let csrfToken;

/**
 * Sets the CSRF token value.
 *
 * The CSRF token can contain alphanumeric, underscore, and hyphen characters.
 *
 * @param {String} csrfToken
 */
export function setCSRFToken(token) {
    assert(token, 'The CSRF Token cannot be a null, undefined, or empty string');
    csrfToken = token;
}
/**
 * Gets the CSRF token value built into the framework
 *
 * @returns {String} the csrf token value
 */
export function getCSRFToken() {
    return csrfToken;
}

export default { getCSRFToken, setCSRFToken };
