import cookie from "cookie_js";

export default class CookieHandler {

    static hasCookie = (name) => {
        return cookie.get('gdpr_' + name, null) !== null;
    }
    static getCookie = (name) => {
        let value = cookie.get('gdpr_' + name, false);
        return (value === true || value === 'true');
    }

    static setCookie = (name, value, options = {}) => {
        cookie.set('gdpr_' + name, value, {
            ...{
                expires: 390,
                path: '/',
            },
            ...options
        })
    }
}