Skip to content
7 changes: 6 additions & 1 deletion src/app/home/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ export default function Home() {


const fetchTeams = async () => {
if (isFetching || !hasMore ) return; // ์ด๋ฏธ ์š”์ฒญ ์ค‘์ด๊ฑฐ๋‚˜ ๋” ์ด์ƒ ๋ถˆ๋Ÿฌ์˜ฌ ๋ฐ์ดํ„ฐ ์—†์œผ๋ฉด ์ค‘๋‹จ
if (isFetching || !hasMore ) { // ์ด๋ฏธ ์š”์ฒญ ์ค‘์ด๊ฑฐ๋‚˜ ๋” ์ด์ƒ ๋ถˆ๋Ÿฌ์˜ฌ ๋ฐ์ดํ„ฐ ์—†์œผ๋ฉด ์ค‘๋‹จ
console.log("fetchTeams ํ˜ธ์ถœ ์ค‘๋‹จ๋จ: isFetching =", isFetching, ", hasMore =", hasMore);
return;
}

console.log("fetchTeams ํ˜ธ์ถœ๋จ - lastTeamId:", lastTeamId);
setIsFetching(true);
try {
const res = await axiosWithAuthorization.get(
Expand All @@ -78,6 +82,7 @@ export default function Home() {

if (newContent.length === 0) {
// ๋ฐ์ดํ„ฐ๊ฐ€ ๋น„์–ด ์žˆ์œผ๋ฉด ๋” ์ด์ƒ ๋ถˆ๋Ÿฌ์˜ฌ ๊ฒŒ ์—†์Œ
console.log("ํŒ€ ์—†์Œ!!!!");
setHasMore(false);
return;
}
Expand Down