refactor: simplify conditional check for class response before fetching rooms

This commit is contained in:
Rémi 2025-01-02 19:30:50 +01:00
parent e6d8a9ae9e
commit c45579221b

View File

@ -48,7 +48,7 @@ const HomePage = () => {
useEffect(() => {
axiosInstance.get<{ id: string, name: string, createdAt: string }[]>("/@me/class")
.then((classResponse) => {
classResponse.data.length > 0 &&
if (classResponse.data.length)
axiosInstance.get<Room[]>(`/@me/class/${classResponse.data[0].id}/rooms`)
.then(classes => {
// Filter rooms by date, get future, actual and past rooms