mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
move album header color methods to composables
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import state from "../state";
|
||||
import { AlbumInfo, Track } from "../../interfaces";
|
||||
import useAxios from "../useAxios";
|
||||
import useAxios from "./useAxios";
|
||||
import { NotifType, useNotifStore } from "@/stores/notification";
|
||||
|
||||
const getAlbumData = async (hash: string, ToastStore: typeof useNotifStore) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Folder, Track } from "@/interfaces";
|
||||
import state from "../state";
|
||||
import useAxios from "../useAxios";
|
||||
import useAxios from "./useAxios";
|
||||
|
||||
export default async function (path: string) {
|
||||
interface FolderData {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Artist } from "../../interfaces";
|
||||
import { Playlist, Track } from "../../interfaces";
|
||||
import { Notification, NotifType } from "../../stores/notification";
|
||||
import state from "../state";
|
||||
import useAxios from "../useAxios";
|
||||
import useAxios from "./useAxios";
|
||||
/**
|
||||
* Creates a new playlist on the server.
|
||||
* @param playlist_name The name of the playlist to create.
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { FetchProps } from "../../interfaces";
|
||||
import axios, { AxiosError, AxiosResponse } from "axios";
|
||||
|
||||
export default async (args: FetchProps) => {
|
||||
let data: any = null;
|
||||
let error: string = null;
|
||||
let status: number = null;
|
||||
|
||||
function getAxios() {
|
||||
if (args.get) {
|
||||
return axios.get(args.url, args.props);
|
||||
}
|
||||
|
||||
if (args.put) {
|
||||
return axios.put(args.url, args.props, args.headers);
|
||||
}
|
||||
|
||||
return axios.post(args.url, args.props);
|
||||
}
|
||||
|
||||
await getAxios()
|
||||
.then((res: AxiosResponse) => {
|
||||
data = res.data;
|
||||
status = res.status;
|
||||
})
|
||||
.catch((err: AxiosError) => {
|
||||
error = err.message as string;
|
||||
status = err.response.status as number;
|
||||
});
|
||||
|
||||
return { data, error, status };
|
||||
};
|
||||
Reference in New Issue
Block a user