fixed the but

This commit is contained in:
CodeServer 2022-03-25 10:43:05 +00:00
parent 5119cd5272
commit ee77e90aa2
3 changed files with 22 additions and 14 deletions

View File

@ -10,7 +10,7 @@ import UserLite from "../../api-bodies/UserLite";
const MeetingsPanel: React.FC = () => {
const meetings = useAppSelector(selectMeetings);
let uuids: string[] = [];
const uuids: string[] = [];
meetings.forEach((meeting) => {
meeting.liveParticipantIds.forEach((uuid) => {
if(!uuids.includes(uuid)) {
@ -19,10 +19,18 @@ const MeetingsPanel: React.FC = () => {
});
});
const participants: UserLite[] = useAppSelector((state) =>
selectUsers(state, uuids)
const participants = useAppSelector((state) =>
selectUsers(state,uuids)
);
// const participants: (UserLite | undefined)[] = [];
// uuids.forEach((uuid) => {
// const userLite = useAppSelector((state) =>
// selectUser(state,uuid)
// );
// participants.push(userLite);
// });
return (
<div className="meetings-panel">
@ -42,7 +50,7 @@ const MeetingsPanel: React.FC = () => {
// );
const meetingMembers: UserLite[] = [];
participants.forEach((userLite) => {
if (meeting.liveParticipantIds.includes(userLite.uuid)) {
if (userLite != undefined && meeting.liveParticipantIds.includes(userLite.uuid)) {
meetingMembers.push(userLite);
}
});
@ -52,7 +60,7 @@ const MeetingsPanel: React.FC = () => {
const endDate = new Date(endDatemil);
const [currentDate, setCurrentDate] = useState<Date>(new Date());
useEffect(() => {
setInterval(() => setCurrentDate(new Date()), 30000);
setInterval(() => setCurrentDate(new Date()), 1000);
}, []);
const currentDatemil = currentDate.getTime();

View File

@ -27,6 +27,7 @@ const Login: React.FC = () => {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [logedInUser, setLogedInUser] = useState("");
// const [errMsg, setErrMsg] = useState('');
// const userRef = useRef();
@ -40,6 +41,10 @@ const Login: React.FC = () => {
// setErrMsg('');
// }, [user, pwd])
store.dispatch(fetchMeetings(logedInUser));
store.dispatch(fetchUsers(logedInUser));
store.dispatch(fetchFavorites(logedInUser));
const handleLogin = async(e: React.SyntheticEvent) => {
e.preventDefault();
@ -48,9 +53,6 @@ const Login: React.FC = () => {
setAuth["email"] = email;
setAuth["isLoggedIn"] = true;
store.dispatch(fetchMeetings(""));
store.dispatch(fetchUsers(""));
store.dispatch(fetchFavorites(""));
navigate(from, { replace: true });
}
@ -71,9 +73,7 @@ const Login: React.FC = () => {
setAuth["email"] = email;
setAuth["isLoggedIn"] = true;
store.dispatch(fetchMeetings(logedInUserId));
store.dispatch(fetchUsers(logedInUserId));
store.dispatch(fetchFavorites(logedInUserId));
setLogedInUser(logedInUserId);
navigate(from, { replace: true });
}

View File

@ -13,7 +13,7 @@ const Clock: React.FC = () => {
const [date, setDate] = useState<Date>(new Date());
useEffect(() => {
setInterval(() => setDate(new Date()), 30000);
setInterval(() => setDate(new Date()), 1000);
}, []);
return (