Skip to content

Commit

Permalink
feat: 쿠키 값 꺼내오는 유틸리티 준비
Browse files Browse the repository at this point in the history
  • Loading branch information
potados99 committed Dec 8, 2021
1 parent 036c1bf commit d0fb379
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/utils/cookie.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export function getCookie(name: string): string | undefined {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);

if (parts.length === 2) {
return parts.pop()?.split(';').shift();
}
}

0 comments on commit d0fb379

Please sign in to comment.