How to use the cookies.readBrowserCookie function in cookies

To help you get started, we’ve selected a few cookies examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github caolan / blog / packages / duality / duality / utils.js View on Github external
exports.getBaseURL = function (/*optional*/req) {
    if (!req) {
        req = exports.currentRequest();
    }
    if ('baseURL' in settings) {
        return settings.baseURL;
    }
    if (exports.isBrowser()) {

        var baseURL = cookies.readBrowserCookie('baseURL');
        if (baseURL) return baseURL;

        var re = new RegExp('(.*\\/_rewrite).*$');
        var match = re.exec(exports.getWindowLocation().pathname);
        if (match) {
            return match[1];
        }
        return '';
    }
    if (req.query.baseURL) {
        return req.query.baseURL;
    }
    if (req.query.db && req.query.ddoc) {
        return '/' + req.query.db + '/_design/' + req.query.ddoc + '/_rewrite/';
    }
github kanso / kanso / packages / duality-flashmessages / duality / flashmessages.js View on Github external
exports.readBrowserCookie = function () {
    var cookie = cookies.readBrowserCookie('_duality_flash');
    var messages = cookie ? JSON.parse(unescape(cookie)): [];
    return _.map(messages, function (val) {
        val.incoming = true;
        val.outgoing = false;
        return val;
    });
};