diff --git a/CookieStorage/wwwroot/js/CookieStorageAccessor.js b/CookieStorage/wwwroot/js/CookieStorageAccessor.js index b578b36..8255f12 100644 --- a/CookieStorage/wwwroot/js/CookieStorageAccessor.js +++ b/CookieStorage/wwwroot/js/CookieStorageAccessor.js @@ -1,9 +1,11 @@ -export function get() +export function get(key) { - return document.cookie; + return document.cookie.split("; ") + .find((row) => row.startsWith(key + "=")) + ?.split("=")[1]; } export function set(key, value) { document.cookie = `${key}=${value}`; -} \ No newline at end of file +}