Skip to content

Commit

Permalink
[fix] 로그인이 되지 않아도 유저 정보를 불러오려고 하는 오류 수정 (#154)
Browse files Browse the repository at this point in the history
fix : 로그인이 되지 않아도 유저 정보를 불러오려고 하는 오류 수정
  • Loading branch information
Novrule authored Dec 6, 2023
1 parent 2c229be commit 1de5c2e
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions client/src/components/Modal/SettingModal/SettingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,20 @@ const SettingModal = ({ onConfirm }: SettingModalProps) => {
}

useEffect(() => {
fetch(`${import.meta.env.VITE_API_URL}` + '/stream-keys/me', { method: 'GET', credentials: 'include' })
.then((res) => {
if (res.ok === true) {
return res.json()
} else {
throw new Error('Get Stream Keys Failed')
}
})
.then((res) => {
setStreamKey(res.streamKey)
})
.catch((err) => console.error(err))
if (user.id !== '') {
fetch(`${import.meta.env.VITE_API_URL}` + '/stream-keys/me', { method: 'GET', credentials: 'include' })
.then((res) => {
if (res.ok === true) {
return res.json()
} else {
throw new Error('Get Stream Keys Failed')
}
})
.then((res) => {
setStreamKey(res.streamKey)
})
.catch((err) => console.error(err))
}
}, [])

return (
Expand Down

0 comments on commit 1de5c2e

Please sign in to comment.