import React, { useRef, useEffect, useState } from 'react'; import { Link } from 'react-router-dom'; import moment from 'moment'; import Notification from '../notification'; import Alert from '../../component/alert'; import PageLoader from '../../component/page_loader'; import InfiniteScroll from "react-infinite-scroll-component"; const INFINITE = 10; const SCROLL_DELAY_TIME = 1500; const Meeting = () => { const [notice, setNotice] = useState(localStorage.getItem('notice')); const [tab_status, setTabStatus] = useState(false); const [loaded, setLoaded] = useState(false); const [loaded1, setLoaded1] = useState(false); const [loaded2, setLoaded2] = useState(false); const [meeting_list_non_approval, setMettingListNonApproval] = useState([]); const [meeting_list_approval, setMettingListApproval] = useState([]); const [fetch_meeting_list_non_approval, setFetchMettingListNonApproval] = useState([]); const [fetch_meeting_list_approval, setFetchMettingListApproval] = useState([]); const [_success, setSuccess] = useState(''); const [_400error, set400Error] = useState(''); const isMountedRef = useRef(true); useEffect(()=>{ if(localStorage.getItem("from_login")){ setSuccess("ログインに成功しました!"); localStorage.removeItem("from_login"); } },[]); useEffect(()=>{ setLoaded(loaded1 && loaded2); },[loaded1, loaded2]) useEffect( async () => { isMountedRef.current = false; setLoaded(false); let child_id = document.getElementById('child_id').value; await axios.get('/api/children/meetings/listOfNonApprovalOfChild', {params:{child_id: child_id}}) .then(response => { setLoaded1(true); setNotice(response.data.notice); if(response.data.status_code==200){ setMettingListNonApproval(response.data.params); var len = response.data.params.length; if(len > INFINITE) setFetchMettingListNonApproval(response.data.params.slice(0, INFINITE)); else setFetchMettingListNonApproval(response.data.params.slice(0, len)); } else { set400Error("失敗しました。"); } }) await axios.get('/api/children/meetings/listOfApprovalOfChild', {params:{child_id: child_id}}) .then(response => { setLoaded2(true); setNotice(response.data.notice); if(response.data.status_code==200){ setMettingListApproval(response.data.params); var len = response.data.params.length; if(len > INFINITE) setFetchMettingListApproval(response.data.params.slice(0, INFINITE)); else setFetchMettingListApproval(response.data.params.slice(0, len)); } else { set400Error("失敗しました。"); } }) },[]); const fetchMoreListNonApproval = () => { setTimeout(() => { var x = fetch_meeting_list_non_approval.length; var y = meeting_list_non_approval.length; var c = 0; if(x+INFINITE < y) c = INFINITE; else c = y - x; setFetchMettingListNonApproval(meeting_list_non_approval.slice(0, x+c)); }, SCROLL_DELAY_TIME); }; const fetchMoreListApproval = () => { setTimeout(() => { var x = fetch_meeting_list_approval.length; var y = meeting_list_approval.length; var c = 0; if(x+INFINITE < y) c = INFINITE; else c = y - x; setFetchMettingListApproval(meeting_list_approval.slice(0, x+c)); }, SCROLL_DELAY_TIME); }; return (
{item.father.company}
{item.text}
データはありません。
}{item.father.company}
{item.text}
データはありません。
}