rename files and set max client width on viewport

This commit is contained in:
geoffrey45
2022-06-16 15:24:56 +03:00
parent 92e2420174
commit 1cc7c933b7
13 changed files with 24 additions and 27 deletions
+66
View File
@@ -0,0 +1,66 @@
import axios, { AxiosError } from "axios";
import state from "../state";
import { AlbumInfo, Track } from "../../interfaces";
import useAxios from "../useAxios";
const getAlbumTracks = async (album: string, artist: string) => {
const url = state.settings.uri + "/album";
interface AlbumData {
info: AlbumInfo;
tracks: Track[];
}
const { data, status } = await useAxios({
url,
props: {
album: album,
artist: artist,
},
});
if (status == 404) {
return {
info: {},
tracks: [],
};
}
return data as AlbumData;
};
const getAlbumArtists = async (album: string, artist: string) => {
const { data, error } = await useAxios({
url: state.settings.uri + "/album/artists",
props: {
album: album,
artist: artist,
},
});
if (error) {
console.error(error);
}
return data.artists;
};
const getAlbumBio = async (album: string, albumartist: string) => {
const { data, status } = await useAxios({
url: state.settings.uri + "/album/bio",
props: {
album: album,
albumartist: albumartist,
},
});
if (data) {
return data.bio;
}
if (status == 404) {
return null;
}
};
export { getAlbumTracks, getAlbumArtists, getAlbumBio };