initial state: muzick music player + recommendation engine
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import api from './api';
|
||||
import type { Artist, ArtistWithAlbums } from '../types';
|
||||
|
||||
export interface ListArtistsParams {
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
}
|
||||
|
||||
export const artistService = {
|
||||
// GET /api/artists
|
||||
async listArtists(params?: ListArtistsParams): Promise<Artist[]> {
|
||||
const res = await api.get<Artist[]>('/artists', { params });
|
||||
return res.data;
|
||||
},
|
||||
|
||||
// GET /api/artists/:id (returns artist + albums)
|
||||
async getArtist(id: string): Promise<ArtistWithAlbums> {
|
||||
const res = await api.get<ArtistWithAlbums>(`/artists/${id}`);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
// POST /api/artists
|
||||
async createArtist(data: Partial<Artist>): Promise<Artist> {
|
||||
const res = await api.post<Artist>('/artists', data);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
// PUT /api/artists/:id
|
||||
async updateArtist(id: string, data: Partial<Artist>): Promise<Artist> {
|
||||
const res = await api.put<Artist>(`/artists/${id}`, data);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
// DELETE /api/artists/:id
|
||||
async deleteArtist(id: string): Promise<{ status: string }> {
|
||||
const res = await api.delete<{ status: string }>(`/artists/${id}`);
|
||||
return res.data;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user