<commit_before>import Credentials from './credentials';

let baseUrl = `/directory-api`;
let sessionUrl = `${baseUrl}/api/v2/session`;
let loginUrl = `${baseUrl}/api/v2/login`;

$.get(sessionUrl)
    .done(function () {
        console.log('session - done', arguments);
    })
    .fail(function () {
        console.log('session - fail', arguments);

        let requestData = {
            client: "rchat",
            clientVersion: "0.0.1",
            detail: {
                semver: "rchat-alpha",
                userAgent: window.navigator.userAgent
            },
            extendedSession: false,
            includeFieldConfigs: false,
            includeRoleInfo: false,
            includeTranslations: false,
            lang: "en_us",
            email: Credentials.username,
            password: <PASSWORD>
        };

        $.ajax({
            type: "POST",
            url: loginUrl,
            data: JSON.stringify(requestData),
            contentType: 'application/json',
            dataType: 'json'
        })
            .done(function () {
                console.log('login - done', arguments);
            })
            .fail(function () {
                console.log('login - fail', arguments);
            })
    });<commit_msg>set the session cookie, even though session checking isn't working<commit_after>import Credentials from './credentials';

let baseUrl = `/directory-api`;
let sessionUrl = `${baseUrl}/api/v2/session`;
let loginUrl = `${baseUrl}/api/v2/login`;

$.get(sessionUrl)
    .done(function () {
        console.log('session - done', arguments);
    })
    .fail(function () {
        console.log('session - fail', arguments);

        let requestData = {
            client: "rchat",
            clientVersion: "0.0.1",
            detail: {
                semver: "rchat-alpha",
                userAgent: window.navigator.userAgent
            },
            extendedSession: false,
            includeFieldConfigs: false,
            includeRoleInfo: false,
            includeTranslations: false,
            lang: "en_us",
            email: Credentials.username,
            password: <PASSWORD>
        };

        $.ajax({
            type: "POST",
            url: loginUrl,
            data: JSON.stringify(requestData),
            contentType: 'application/json',
            dataType: 'json'
        })
            .done(function ({res}) {
                let cookie = 'X-OrgBook-Auth-Key';
                let value = res[cookie];

                $.cookie(cookie, value, { expires: 7 });
            })
            .fail(function () {
                console.log('login - fail', arguments);
            })
    });
{'fraction_non_alphanumeric': 0.1314221891288161, 'fraction_numerical': 0.004095309009679821, 'mean_word_length': 1.576222435282838, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5061016', 'n_tokens_mistral': 731, 'n_tokens_neox': 711, 'n_words': 149}