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

View File

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

View File

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