export module ConsentRepository {

    const consentedCookieStorageKey = 'consented-cookies';
    let cookieConsentPromiseResolve: any;

    const cookieConsentPromise = new Promise<void>(((resolve, reject) => {

        cookieConsentPromiseResolve = resolve;
    }));

    export function getCookieConsent() : Promise<void> {

        return cookieConsentPromise;
    }

    export function consentToUsingCookies() {

        localStorage.setItem(consentedCookieStorageKey, 'true');
        cookieConsentPromiseResolve();
    }

    export function alreadyConsentedToUsingCookies(): boolean {

        return localStorage.getItem(consentedCookieStorageKey) == 'true';
    }

    if (alreadyConsentedToUsingCookies()) {

        consentToUsingCookies();
    }
}
export module ConsentRepository {

    let cookieConsentPromiseResolve: any;

    const cookieConsentPromise = new Promise<void>(((resolve, reject) => {

        cookieConsentPromiseResolve = resolve;
    }));

    export function getCookieConsent() : Promise<void> {

        return cookieConsentPromise;
    }

    export function consentToUsingCookies() {

        cookieConsentPromiseResolve();
    }

    export function alreadyConsentedToUsingCookies(): boolean {

        return false;
    }

    if (alreadyConsentedToUsingCookies()) {

        consentToUsingCookies();
    }
}
--- 
+++ 
@@ -1,5 +1,6 @@
 export module ConsentRepository {
 
+    const consentedCookieStorageKey = 'consented-cookies';
     let cookieConsentPromiseResolve: any;
 
     const cookieConsentPromise = new Promise<void>(((resolve, reject) => {
@@ -14,12 +15,13 @@
 
     export function consentToUsingCookies() {
 
+        localStorage.setItem(consentedCookieStorageKey, 'true');
         cookieConsentPromiseResolve();
     }
 
     export function alreadyConsentedToUsingCookies(): boolean {
 
-        return false;
+        return localStorage.getItem(consentedCookieStorageKey) == 'true';
     }
 
     if (alreadyConsentedToUsingCookies()) {
Store cookie consent in local storage
