const { localParticipant } = useLocalParticipant();
//NOTE - role 구조: {jobName: string, userList: []}
const jobNameList = Object.keys(role);
//NOTE - 해당 player의 직업
const playerJob = jobNameList.find((job) => {
//NOTE - 직업별 해당 userId[]
const jobPlayerList = role[job];
//NOTE - 직업이 존재하지 않을 경우
if (!jobPlayerList) {
return;
}
// 현재 player의 직업 찾기
const isPlayerJob = jobPlayerList.find((userId: string) => localParticipant.identity === userId);
if (isPlayerJob) {
return job;
}