Skip to content

Commit

Permalink
Rename to fetchQuestionSets
Browse files Browse the repository at this point in the history
  • Loading branch information
leung018 committed Jun 10, 2024
1 parent 78b6652 commit 2b8bb11
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/app/components/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ export class HomePageUIService {
}

getElement() {
return <HomePage getQuestionSets={this.getSortedQuestionSets}></HomePage>
return <HomePage fetchQuestionSets={this.getSortedQuestionSets}></HomePage>
}
}

function HomePage({
getQuestionSets,
fetchQuestionSets,
}: {
getQuestionSets: () => readonly QuestionSet[]
fetchQuestionSets: () => readonly QuestionSet[]
}) {
const router = useRouter()
const [isLoading, setLoading] = useState(true)

const [questionSets, setQuestionSets] = useState<readonly QuestionSet[]>([])
useEffect(() => {
setQuestionSets(getQuestionSets())
setQuestionSets(fetchQuestionSets())
setLoading(false)
}, [getQuestionSets])
}, [fetchQuestionSets])

if (isLoading) {
return <LoadingSpinner />
Expand Down

0 comments on commit 2b8bb11

Please sign in to comment.