generated from nim-od/softeer-mono-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from softeerbootcamp4th/TASK-195
[Feature][Task-195] 서버 api, socket 연동 테스트 완료
- Loading branch information
Showing
46 changed files
with
244 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export { ACCESS_TOKEN_KEY, REFRESH_TOKEN_KEY } from './api.ts'; | ||
export { default as CATEGORIES } from './categories.ts'; | ||
export { CHAT_SOCKET_ENDPOINTS, RACING_SOCKET_ENDPOINTS } from './socket.ts'; | ||
export * from './socket.ts'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import CATEGORIES from 'src/constants/categories.ts'; | ||
|
||
export type Category = (typeof CATEGORIES)[number]; | ||
export type SocketCategory = 'p' | 't' | 's' | 'l'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function clearCookie(name: string): void { | ||
document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`; | ||
} | ||
|
||
export default clearCookie; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
function getCookie(name: string) { | ||
function getCookie<T>(name: string): T | null { | ||
const cookies = document.cookie.split('; '); | ||
if (cookies.length === 1 && cookies[0] === '') { | ||
return null; | ||
} | ||
let returnValue = null; | ||
let returnValue: T | null = null; | ||
cookies.some((cookie) => { | ||
const [key, value] = cookie.split('='); | ||
if (key === name) { | ||
returnValue = value; | ||
returnValue = JSON.parse(value); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
return returnValue; | ||
} | ||
|
||
export default getCookie; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import clearCookie from './clearCookie.ts'; | ||
import getCookie from './getCookie.ts'; | ||
import setCookie from './setCookie.ts'; | ||
|
||
export default { getCookie, setCookie }; | ||
export default { getCookie, setCookie, clearCookie }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
function setCookie(name: string, value: string, days: number) { | ||
let expires = ''; | ||
if (days) { | ||
const date = new Date(); | ||
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); | ||
expires = `; expires=${date.toUTCString()}`; | ||
} | ||
document.cookie = `${name}=${value || ''}${expires}; path=/`; | ||
const DAY = 24 * 60 * 60 * 1000; | ||
|
||
function setCookie<T>(name: string, value: T, expirationDays: number = 7): void { | ||
const date = new Date(); | ||
date.setTime(date.getTime() + expirationDays * DAY); | ||
const expires = `; expires=${date.toUTCString()}`; | ||
document.cookie = `${name}=${JSON.stringify(value) || ''}${expires}; path=/`; | ||
} | ||
|
||
export default setCookie; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import cookie from './cookie/index.ts'; | ||
import Cookie from './cookie/index.ts'; | ||
|
||
export default cookie; | ||
export default Cookie; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 7 additions & 8 deletions
15
packages/user/src/components/event/racing/controls/ChargeButtonContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.