Skip to content

Commit

Permalink
๐Ÿ›  fix : ํด๋ผ์ด์–ธํŠธ ์ฟ ํ‚ค ์‚ฌ์šฉ์‹œ document is not finded
Browse files Browse the repository at this point in the history
  • Loading branch information
seondal committed Sep 3, 2024
1 parent 33be7a0 commit 66ba170
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/utils/cookie.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ export const setClientCookie = (key: string, value: string, options?: { expires?
};

export const getClientCookie = (key: string) => {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${key}=`);
if (typeof window !== 'undefined') {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${key}=`);

return parts.pop()?.split(';').shift();
return parts.pop()?.split(';').shift();
}
};

export const removeClientCookie = (key: string) => {
Expand Down

0 comments on commit 66ba170

Please sign in to comment.