Front: Home Page: Use History

This commit is contained in:
Arthur Jamet
2023-04-12 11:31:20 +01:00
parent ac4d4f6f66
commit 4f9a3a9333
5 changed files with 59 additions and 26 deletions
+4 -6
View File
@@ -342,12 +342,10 @@ export default class API {
/**
* Retrieve the authenticated user's play history
*/
public static async getUserPlayHistory(): Promise<Song[]> {
const queryClient = new QueryClient();
let songs = await queryClient.fetchQuery(["API", "allsongs"], API.getAllSongs);
const shuffled = [...songs].sort(() => 0.5 - Math.random());
return shuffled.slice(0, 3);
public static async getUserPlayHistory(): Promise<SongHistory[]> {
return this.fetch({
route: '/history'
});
}
/**