Skip to content

Commit

Permalink
🐛 아고라 모임방 재접속 문제 수정
Browse files Browse the repository at this point in the history
아고라 모임방 나갔다가 재 접속시 제대로 모임방 입장안되는 문제 수정
  • Loading branch information
Changyu-Ryou committed Dec 15, 2021
1 parent 259b23f commit 1d325f0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/MeetingPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect, useState } from 'react';

import { useQueryParams } from '@karrotframe/navigator';
import { AgoraRTCError, UID } from 'agora-rtc-react';

import { InfoType, validateMeetingCode } from '../../api/agora';
Expand Down Expand Up @@ -30,6 +31,8 @@ const AgoraMeetingPage = () => {
const [info, setInfo] = useState<InfoType | undefined>(undefined);
const [meetingCode, setMeetingCode] = useState<string>('');

const querystring: Partial<{ meeting_code: string }> = useQueryParams();

const fetchMeetingData = async (code: string) => {
const result = await validateMeetingCode(code);
if (result.success && result.data) {
Expand All @@ -41,10 +44,7 @@ const AgoraMeetingPage = () => {

useEffect(() => {
if (!info) {
const urlHashParams = new URLSearchParams(
window.location.hash.substr(window.location.hash.indexOf('?')),
);
const code = urlHashParams.get('meeting_code');
const code = querystring.meeting_code;
if (!code)
setInCall({ state: 'error', message: '올바르지 않은 접근이에요' });
code && setMeetingCode(code);
Expand All @@ -59,7 +59,7 @@ const AgoraMeetingPage = () => {
return () => {
sessionStorage.removeItem('Authorization');
};
}, [info]);
}, [info, querystring]);

return inCall.state === 'calling' && info ? (
<MeetingRoom setInCall={setInCall} info={info} code={meetingCode} />
Expand Down

0 comments on commit 1d325f0

Please sign in to comment.