Skip to content

Commit dd10564

Browse files
committed
feat: streamKey 요청 로직 추가
1 parent 6846415 commit dd10564

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

frontend/src/components/host/SettingInfo.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@ import styled from 'styled-components';
22
import OBSIcon from '@assets/img_studio_obs.png';
33
import DownloadIcon from '@assets/download.svg';
44
import { getOrCreateId } from '@utils/id';
5+
import useFetchStreamKey from '@queries/host/useFetchStreamKey';
6+
import { useEffect } from 'react';
57

68
interface SettingInfoProps {
79
closeModal: () => void;
810
}
911

1012
export default function SettingInfo({ closeModal }: SettingInfoProps) {
1113
const userId = getOrCreateId();
14+
const { mutate: fetchKey, data } = useFetchStreamKey();
15+
16+
useEffect(() => {
17+
fetchKey(userId);
18+
}, []);
1219

1320
return (
1421
<PopupOverlay onClick={closeModal}>
@@ -57,8 +64,10 @@ export default function SettingInfo({ closeModal }: SettingInfoProps) {
5764
<SettingRow>
5865
<Label htmlFor="stream-key">스트림 키</Label>
5966
<ValueWithButton>
60-
<StreamKeyInput type="password" readOnly value="djjrx3ufdxqbrv1apr9lo5y9ly07nuyp" />
61-
<CopyButton onClick={() => navigator.clipboard.writeText('djjrx3ufdxqbrv1apr9lo5y9ly07nuyp')}>
67+
<StreamKeyInput type="password" readOnly value={data?.['stream-key'] ?? ''} />
68+
<CopyButton
69+
onClick={() => data?.['stream-key'] && navigator.clipboard.writeText(data['stream-key'])}
70+
>
6271
복사
6372
</CopyButton>
6473
</ValueWithButton>

frontend/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"@assets/*": ["src/assets/*"],
1919
"@styles/*": ["src/styles/*"],
2020
"@type/*": ["src/type/*"],
21-
"@apis/*": ["src/apis/*"]
21+
"@apis/*": ["src/apis/*"],
22+
"@queries/*": ["src/queries/*"]
2223
},
2324
"types": ["vite/client"]
2425
},

0 commit comments

Comments
 (0)