Skip to content

Commit

Permalink
fix: 참여자 페이지 게스트 토큰 임시 추가
Browse files Browse the repository at this point in the history
진상님 디버깅을 위해 임시 추가합니다.
  • Loading branch information
Jw705 committed Dec 12, 2023
1 parent 650e07f commit ff2c70b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { useNavigate, useLocation } from "react-router-dom";
import axios from "axios";

import VolumeMeter from "./VolumeMeter";
import useAuth from "@/hooks/useAuth";

import PlayIcon from "@/assets/svgs/play.svg?react";
import StopIcon from "@/assets/svgs/stop.svg?react";
import MicOnIcon from "@/assets/svgs/micOn.svg?react";
Expand All @@ -15,7 +17,6 @@ import Modal from "@/components/Modal/Modal";
import { useToast } from "@/components/Toast/useToast";
import { ICanvasData, saveCanvasData } from "@/utils/fabricCanvasUtil";
import { convertMsTohhmm } from "@/utils/convertMsToTimeString";
import useAuth from "@/hooks/useAuth";
import calcNormalizedVolume from "@/utils/calcNormalizedVolume";

import selectedMicrophoneState from "@/stores/stateSelectedMicrophone";
Expand All @@ -30,9 +31,6 @@ interface HeaderInstructorControlsProps {
}

const HeaderInstructorControls = ({ setLectureCode, setLectureTitle }: HeaderInstructorControlsProps) => {
const { checkAuth } = useAuth();
const isLectureStartRef = useRef<boolean>(false);

const [isMicOn, setIsMicOn] = useState(true);
const [isStartModalOpen, setIsStartModalOpen] = useState(false);
const [isCloseModalOpen, setIsCloseModalOpen] = useState(false);
Expand All @@ -46,7 +44,9 @@ const HeaderInstructorControls = ({ setLectureCode, setLectureTitle }: HeaderIns
const setInstructorSocket = useSetRecoilState(instructorSocketState);
const navigate = useNavigate();
const showToast = useToast();
const { checkAuth } = useAuth();

const isLectureStartRef = useRef<boolean>(false);
const timerIdRef = useRef<number | null>(null); // 경과 시간 표시 타이머 id
const onFrameIdRef = useRef<number | null>(null); // 마이크 볼륨 측정 타이머 id
const managerRef = useRef<Manager>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { useNavigate, useLocation } from "react-router-dom";
import axios from "axios";

import VolumeMeter from "./VolumeMeter";
import useAuth from "@/hooks/useAuth";

import StopIcon from "@/assets/svgs/stop.svg?react";
import MicOnIcon from "@/assets/svgs/micOn.svg?react";
import MicOffIcon from "@/assets/svgs/micOff.svg?react";
Expand Down Expand Up @@ -54,10 +56,11 @@ const HeaderParticipantControls = ({ setLectureCode, setLectureTitle }: HeaderPa

const navigate = useNavigate();
const showToast = useToast();
const { checkAuth } = useAuth();

const roomid = new URLSearchParams(useLocation().search).get("roomid") || "999999";
const sampleAccessToken =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InBsYXRpbm91c3MwMkBnbWFpbC5jb20iLCJpYXQiOjE3MDE2ODUyMDYsImV4cCI6MTcwMjcyMjAwNn0.gNXyIPGyaBKX5KjBVB6USNWGEc3k9ZruCTglCGeLo3Y";
const guestAccessToken =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InBsYXRpbm91c3MxNEBnbWFpbC5jb20iLCJpYXQiOjE3MDIzNjA4OTMsImV4cCI6MTcwMzM5NzY5M30.nSbiGLp03Zmz0xNdlmAKDWEAuPXJfZu4MBwVW9JW6Yk";
const pc_config = {
iceServers: [
{
Expand All @@ -67,6 +70,7 @@ const HeaderParticipantControls = ({ setLectureCode, setLectureTitle }: HeaderPa
};

useEffect(() => {
checkAuth();
setDidMount(true);
const backToMain = () => {
leaveLecture({ isLectureEnd: false });
Expand Down Expand Up @@ -158,10 +162,11 @@ const HeaderParticipantControls = ({ setLectureCode, setLectureTitle }: HeaderPa
// guest 판별 로직 추가 예정
socketRef.current = managerRef.current.socket("/enter-room", {
auth: {
accessToken: sampleAccessToken,
accessToken: guestAccessToken,
refreshToken: "test"
}
});
// accessToken: localStorage.getItem("token") ? localStorage.getItem("token") : "",

if (!socketRef.current) return;
socketRef.current.on(`serverAnswer`, (data) => handleServerAnswer(data));
Expand Down Expand Up @@ -293,10 +298,11 @@ const HeaderParticipantControls = ({ setLectureCode, setLectureTitle }: HeaderPa
if (!managerRef.current) return;
lectureSocketRef.current = managerRef.current.socket("/lecture", {
auth: {
accessToken: sampleAccessToken,
accessToken: guestAccessToken,
refreshToken: "sample"
}
});
// accessToken: localStorage.getItem("token") ? localStorage.getItem("token") : "",
setParticipantSocket(lectureSocketRef.current);
lectureSocketRef.current.on("ended", () => handleLectureEnd());
lectureSocketRef.current.on("update", (data) => handleWhiteboardUpdate(data));
Expand Down

0 comments on commit ff2c70b

Please sign in to comment.