-
Notifications
You must be signed in to change notification settings - Fork 4
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 #267 from boostcampwm-2024/dev-fe
[MERGE] dev-fe to prod-fe
- Loading branch information
Showing
43 changed files
with
866 additions
and
306 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { AxiosResponse } from 'axios'; | ||
import { fetchInstance } from '.'; | ||
import { LiveExistenceResponse } from '@type/live'; | ||
|
||
export const checkLiveExist = async ({ liveId }: { liveId: string }): Promise<LiveExistenceResponse> => { | ||
const response: AxiosResponse<LiveExistenceResponse> = await fetchInstance().get('/streams/existence', { | ||
params: { | ||
sessionKey: liveId | ||
} | ||
}); | ||
|
||
return response.data; | ||
}; |
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,13 @@ | ||
import { AxiosResponse } from 'axios'; | ||
import { fetchInstance } from '.'; | ||
import { ReplayExistenceResponse } from '@type/replay'; | ||
|
||
export const checkReplayExist = async ({ videoId }: { videoId: string }): Promise<ReplayExistenceResponse> => { | ||
const response: AxiosResponse<ReplayExistenceResponse> = await fetchInstance().get('/replay/existence', { | ||
params: { | ||
videoId | ||
} | ||
}); | ||
|
||
return response.data; | ||
}; |
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 @@ | ||
import { AxiosResponse } from 'axios'; | ||
import { fetchInstance } from '.'; | ||
import { ClientLive } from '@type/live'; | ||
import { ClientLiveResponse } from '@type/live'; | ||
|
||
type ClientLiveResponse = { | ||
info: ClientLive; | ||
}; | ||
|
||
export const fetchLive = async ({ liveId }: { liveId: string }): Promise<ClientLive> => { | ||
const response: AxiosResponse<ClientLiveResponse> = await fetchInstance().get('/streams/live', { | ||
params: { | ||
liveId | ||
export const fetchLive = async ({ liveId }: { liveId: string }): Promise<ClientLiveResponse> => { | ||
try { | ||
const response: AxiosResponse = await fetchInstance().get('/streams/live', { | ||
params: { liveId } | ||
}); | ||
return response.data; | ||
} catch (error: any) { | ||
if (error.response && error.response.status === 400) { | ||
console.log('error', error); | ||
throw error; | ||
} | ||
}); | ||
|
||
return response.data.info; | ||
throw error; | ||
} | ||
}; |
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,20 @@ | ||
import { AxiosResponse } from 'axios'; | ||
import { fetchInstance } from '.'; | ||
import { ReplayStream } from '@type/replay'; | ||
import { ClientReplayResponse } from '@type/replay'; | ||
|
||
type ReplayStreamResponse = { | ||
info: ReplayStream; | ||
}; | ||
|
||
export const fetchReplay = async ({ videoId }: { videoId: string }): Promise<ReplayStream> => { | ||
const response: AxiosResponse<ReplayStreamResponse> = await fetchInstance().get('/replay/video', { | ||
params: { | ||
videoId | ||
export const fetchReplay = async ({ videoId }: { videoId: string }): Promise<ClientReplayResponse> => { | ||
try { | ||
const response: AxiosResponse = await fetchInstance().get('/replay/video', { | ||
params: { | ||
videoId | ||
} | ||
}); | ||
return response.data; | ||
} catch (error: any) { | ||
if (error.response && error.response.status === 400) { | ||
console.log('error', error); | ||
throw error; | ||
} | ||
}); | ||
|
||
return response.data.info; | ||
throw error; | ||
} | ||
}; |
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,13 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import { checkLiveExist } from '@apis/checkLiveExist'; | ||
import { LiveExistenceResponse } from '@type/live'; | ||
|
||
export const useCheckLiveExist = ({ liveId }: { liveId: string }) => { | ||
return useQuery<LiveExistenceResponse, Error>({ | ||
queryKey: ['checkLiveExist'], | ||
queryFn: () => checkLiveExist({ liveId }), | ||
refetchOnWindowFocus: false, | ||
initialData: { existed: true } | ||
}); | ||
}; |
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,12 +1,14 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import { fetchLive } from '@apis/fetchLive'; | ||
import { ClientLive } from '@type/live'; | ||
import { ClientLive, ClientLiveResponse } from '@type/live'; | ||
|
||
export const useClientLive = ({ liveId }: { liveId: string }) => { | ||
return useQuery<ClientLive, Error>({ | ||
return useQuery<ClientLiveResponse, Error>({ | ||
queryKey: ['clientLive'], | ||
queryFn: () => fetchLive({ liveId: liveId }), | ||
refetchOnWindowFocus: false | ||
queryFn: () => fetchLive({ liveId }), | ||
refetchOnWindowFocus: false, | ||
initialData: { info: {} as ClientLive }, | ||
throwOnError: true, | ||
retry: 0, | ||
}); | ||
}; |
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,13 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import { checkReplayExist } from '@apis/checkReplayExist'; | ||
import { ReplayExistenceResponse } from '@type/replay'; | ||
|
||
export const useCheckReplayExist = ({ videoId }: { videoId: string }) => { | ||
return useQuery<ReplayExistenceResponse, Error>({ | ||
queryKey: ['checkReplayExist'], | ||
queryFn: () => checkReplayExist({ videoId }), | ||
refetchOnWindowFocus: false, | ||
initialData: { existed: true } | ||
}); | ||
}; |
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,12 +1,15 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import { fetchReplay } from '@apis/fetchReplay'; | ||
import { ReplayStream } from '@type/replay'; | ||
import { ClientReplayResponse, ReplayStream } from '@type/replay'; | ||
|
||
export const useClientReplay = ({ videoId }: { videoId: string }) => { | ||
return useQuery<ReplayStream, Error>({ | ||
return useQuery<ClientReplayResponse, Error>({ | ||
queryKey: ['clientReplay'], | ||
queryFn: () => fetchReplay({ videoId: videoId }), | ||
refetchOnWindowFocus: false | ||
queryFn: () => fetchReplay({ videoId }), | ||
refetchOnWindowFocus: false, | ||
initialData: { info: {} as ReplayStream }, | ||
throwOnError: true, | ||
retry: 0 | ||
}); | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.