diff --git a/frontend/src/components/host/SettingInfo.tsx b/frontend/src/components/host/SettingInfo.tsx index fce5f38b..51b27ec3 100644 --- a/frontend/src/components/host/SettingInfo.tsx +++ b/frontend/src/components/host/SettingInfo.tsx @@ -2,6 +2,8 @@ import styled from 'styled-components'; import OBSIcon from '@assets/img_studio_obs.png'; import DownloadIcon from '@assets/download.svg'; import { getOrCreateId } from '@utils/id'; +import useFetchStreamKey from '@queries/host/useFetchStreamKey'; +import { useEffect } from 'react'; interface SettingInfoProps { closeModal: () => void; @@ -9,6 +11,11 @@ interface SettingInfoProps { export default function SettingInfo({ closeModal }: SettingInfoProps) { const userId = getOrCreateId(); + const { mutate: fetchKey, data } = useFetchStreamKey(); + + useEffect(() => { + fetchKey(userId); + }, []); return ( @@ -57,8 +64,10 @@ export default function SettingInfo({ closeModal }: SettingInfoProps) { - - navigator.clipboard.writeText('djjrx3ufdxqbrv1apr9lo5y9ly07nuyp')}> + + data?.['stream-key'] && navigator.clipboard.writeText(data['stream-key'])} + > 복사 diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 168f9617..2abd93f0 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -18,7 +18,8 @@ "@assets/*": ["src/assets/*"], "@styles/*": ["src/styles/*"], "@type/*": ["src/type/*"], - "@apis/*": ["src/apis/*"] + "@apis/*": ["src/apis/*"], + "@queries/*": ["src/queries/*"] }, "types": ["vite/client"] },