Skip to content

Commit

Permalink
feat: streamKey 요청 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jsk3342 committed Nov 14, 2024
1 parent 6846415 commit dd10564
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 11 additions & 2 deletions frontend/src/components/host/SettingInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ 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;
}

export default function SettingInfo({ closeModal }: SettingInfoProps) {
const userId = getOrCreateId();
const { mutate: fetchKey, data } = useFetchStreamKey();

useEffect(() => {
fetchKey(userId);
}, []);

Check warning on line 18 in frontend/src/components/host/SettingInfo.tsx

View workflow job for this annotation

GitHub Actions / build (frontend)

React Hook useEffect has missing dependencies: 'fetchKey' and 'userId'. Either include them or remove the dependency array

return (
<PopupOverlay onClick={closeModal}>
Expand Down Expand Up @@ -57,8 +64,10 @@ export default function SettingInfo({ closeModal }: SettingInfoProps) {
<SettingRow>
<Label htmlFor="stream-key">스트림 키</Label>
<ValueWithButton>
<StreamKeyInput type="password" readOnly value="djjrx3ufdxqbrv1apr9lo5y9ly07nuyp" />
<CopyButton onClick={() => navigator.clipboard.writeText('djjrx3ufdxqbrv1apr9lo5y9ly07nuyp')}>
<StreamKeyInput type="password" readOnly value={data?.['stream-key'] ?? ''} />
<CopyButton
onClick={() => data?.['stream-key'] && navigator.clipboard.writeText(data['stream-key'])}
>
복사
</CopyButton>
</ValueWithButton>
Expand Down
3 changes: 2 additions & 1 deletion frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
},
Expand Down

0 comments on commit dd10564

Please sign in to comment.