mirror of
https://github.com/swingmx/webclient.git
synced 2025-12-24 19:30:20 +00:00
32 lines
998 B
TypeScript
32 lines
998 B
TypeScript
import { paths } from '@/config'
|
|
import useAxios from './useAxios'
|
|
|
|
export async function getChartItem(item: string, duration: string, limit: number, order_by: string) {
|
|
const res = await useAxios({
|
|
url: paths.api.stats.base + `/top-${item}?duration=${duration}&limit=${limit}&order_by=${order_by}`,
|
|
method: 'GET',
|
|
})
|
|
|
|
return res
|
|
}
|
|
|
|
export async function getTopArtists(duration: number, limit: number, order_by: string) {
|
|
return await getChartItem('artists', duration, limit, order_by)
|
|
}
|
|
|
|
export async function getTopAlbums(duration: number, limit: number, order_by: string) {
|
|
return await getChartItem('albums', duration, limit, order_by)
|
|
}
|
|
|
|
export async function getTopTracks(duration: string, limit: number, order_by: string) {
|
|
return await getChartItem('tracks', duration, limit, order_by)
|
|
}
|
|
|
|
export async function getStats() {
|
|
const res = await useAxios({
|
|
url: paths.api.stats.base + "/stats",
|
|
method: 'GET',
|
|
})
|
|
|
|
return res
|
|
} |