|
@ -10,6 +10,7 @@ import { useAppDispatch, useAppSelector } from '../../redux/hooks'; |
|
|
import { setStar } from '../../redux/playQueueSlice'; |
|
|
import { setStar } from '../../redux/playQueueSlice'; |
|
|
import { setActive } from '../../redux/albumSlice'; |
|
|
import { setActive } from '../../redux/albumSlice'; |
|
|
import { apiController } from '../../api/controller'; |
|
|
import { apiController } from '../../api/controller'; |
|
|
|
|
|
import { Server } from '../../types'; |
|
|
|
|
|
|
|
|
const Dashboard = () => { |
|
|
const Dashboard = () => { |
|
|
const history = useHistory(); |
|
|
const history = useHistory(); |
|
@ -31,9 +32,13 @@ const Dashboard = () => { |
|
|
() => |
|
|
() => |
|
|
apiController({ |
|
|
apiController({ |
|
|
serverType: config.serverType, |
|
|
serverType: config.serverType, |
|
|
endpoint: 'getAlbums', |
|
|
endpoint: config.serverType === Server.Jellyfin ? 'getSongs' : 'getAlbums', |
|
|
args: { type: 'recent', size: 20, offset: 0, musicFolderId: musicFolder }, |
|
|
args: { type: 'recent', size: 20, offset: 0, order: 'desc', musicFolderId: musicFolder }, |
|
|
}) |
|
|
}), |
|
|
|
|
|
{ |
|
|
|
|
|
refetchOnWindowFocus: true, |
|
|
|
|
|
refetchInterval: 30000, |
|
|
|
|
|
} |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
const { isLoading: isLoadingNewest, data: newestAlbums }: any = useQuery( |
|
|
const { isLoading: isLoadingNewest, data: newestAlbums }: any = useQuery( |
|
@ -61,9 +66,12 @@ const Dashboard = () => { |
|
|
() => |
|
|
() => |
|
|
apiController({ |
|
|
apiController({ |
|
|
serverType: config.serverType, |
|
|
serverType: config.serverType, |
|
|
endpoint: 'getAlbums', |
|
|
endpoint: config.serverType === Server.Jellyfin ? 'getSongs' : 'getAlbums', |
|
|
args: { type: 'frequent', size: 20, offset: 0, musicFolderId: musicFolder }, |
|
|
args: { type: 'frequent', size: 20, offset: 0, order: 'desc', musicFolderId: musicFolder }, |
|
|
}) |
|
|
}), |
|
|
|
|
|
{ |
|
|
|
|
|
refetchOnWindowFocus: true, |
|
|
|
|
|
} |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
const handleFavorite = async (rowData: any) => { |
|
|
const handleFavorite = async (rowData: any) => { |
|
@ -180,7 +188,7 @@ const Dashboard = () => { |
|
|
history.push(`/library/album?sortType=recent`); |
|
|
history.push(`/library/album?sortType=recent`); |
|
|
}, 50); |
|
|
}, 50); |
|
|
}} |
|
|
}} |
|
|
type="album" |
|
|
type="music" |
|
|
handleFavorite={handleFavorite} |
|
|
handleFavorite={handleFavorite} |
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
@ -252,7 +260,7 @@ const Dashboard = () => { |
|
|
history.push(`/library/album?sortType=frequent`); |
|
|
history.push(`/library/album?sortType=frequent`); |
|
|
}, 50); |
|
|
}, 50); |
|
|
}} |
|
|
}} |
|
|
type="album" |
|
|
type="music" |
|
|
handleFavorite={handleFavorite} |
|
|
handleFavorite={handleFavorite} |
|
|
/> |
|
|
/> |
|
|
</> |
|
|
</> |
|
|