diff --git a/screeens/StreamerSpace/AllSpacePosts/index.jsx b/screeens/StreamerSpace/AllSpacePosts/index.jsx index 8db8fd1..6e27416 100644 --- a/screeens/StreamerSpace/AllSpacePosts/index.jsx +++ b/screeens/StreamerSpace/AllSpacePosts/index.jsx @@ -16,9 +16,12 @@ export default function AllSpacePosts({ zid }) { const [data, setData] = useState([]); const [offset, setOffset] = useState(0); const [more, setMore] = useState(1); + const [isFetching, setIsFetching] = useState(false); const getData = async () => { if (zid === undefined) return; if (!more) return; + if (isFetching) return; + setIsFetching(true); const apiUrl = process.env.EXPO_PUBLIC_API_URL; try { const base = await baseRequest(); @@ -54,6 +57,8 @@ export default function AllSpacePosts({ zid }) { setMore(_data.data.more); } catch (error) { console.error(error); + } finally { + setIsFetching(false); } }; diff --git a/screeens/StreamerSpace/IronFanSpacePosts/index.jsx b/screeens/StreamerSpace/IronFanSpacePosts/index.jsx index 2f33307..4f8d914 100644 --- a/screeens/StreamerSpace/IronFanSpacePosts/index.jsx +++ b/screeens/StreamerSpace/IronFanSpacePosts/index.jsx @@ -16,9 +16,12 @@ export default function IronFanSpacePosts({ zid }) { const [data, setData] = useState([]); const [offset, setOffset] = useState(0); const [more, setMore] = useState(1); + const [isFetching, setIsFetching] = useState(false); const getData = async () => { if (zid === undefined) return; if (!more) return; + if (isFetching) return; + setIsFetching(true); const apiUrl = process.env.EXPO_PUBLIC_API_URL; try { const base = await baseRequest(); @@ -56,6 +59,8 @@ export default function IronFanSpacePosts({ zid }) { setMore(_data.data.more); } catch (error) { console.error(error); + } finally { + setIsFetching(false); } }; diff --git a/screeens/StreamerSpace/SuperFanSpacePosts/index.jsx b/screeens/StreamerSpace/SuperFanSpacePosts/index.jsx index ddbb343..87097ee 100644 --- a/screeens/StreamerSpace/SuperFanSpacePosts/index.jsx +++ b/screeens/StreamerSpace/SuperFanSpacePosts/index.jsx @@ -16,9 +16,12 @@ export default function SuperFanSpacePosts({ zid }) { const [data, setData] = useState([]); const [offset, setOffset] = useState(0); const [more, setMore] = useState(1); + const [isFetching, setIsFetching] = useState(false); const getData = async () => { if (zid === undefined) return; if (!more) return; + if (isFetching) return; + setIsFetching(true); const apiUrl = process.env.EXPO_PUBLIC_API_URL; try { const base = await baseRequest(); @@ -55,6 +58,8 @@ export default function SuperFanSpacePosts({ zid }) { setMore(_data.data.more); } catch (error) { console.error(error); + } finally { + setIsFetching(false); } };