mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-08 21:10:12 +02:00
Add genres api
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { BaseResponse, Genre } from '@/renderer/api/types';
|
||||
import { ax } from '@/renderer/lib/axios';
|
||||
|
||||
export type GenreListResponse = BaseResponse<Genre[]>;
|
||||
|
||||
const getGenreList = async (
|
||||
query: { serverId: string },
|
||||
signal?: AbortSignal
|
||||
) => {
|
||||
const { data } = await ax.get<GenreListResponse>(
|
||||
`/servers/${query.serverId}/genres`,
|
||||
{
|
||||
signal,
|
||||
}
|
||||
);
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
export const genresApi = {
|
||||
getGenreList,
|
||||
};
|
||||
@@ -1,14 +1,16 @@
|
||||
import { albumsApi } from '@/renderer/api/albums.api';
|
||||
import { authApi } from '@/renderer/api/auth.api';
|
||||
import { genresApi } from '@/renderer/api/genres.api';
|
||||
import { serversApi } from '@/renderer/api/servers.api';
|
||||
import { tasksApi } from '@/renderer/api/tasks.api';
|
||||
import { albumsApi } from './albums.api';
|
||||
import { authApi } from './auth.api';
|
||||
import { serversApi } from './servers.api';
|
||||
import { usersApi } from './users.api';
|
||||
import { usersApi } from '@/renderer/api/users.api';
|
||||
|
||||
export * from './sockets.api';
|
||||
|
||||
export const api = {
|
||||
albums: albumsApi,
|
||||
auth: authApi,
|
||||
genres: genresApi,
|
||||
servers: serversApi,
|
||||
tasks: tasksApi,
|
||||
users: usersApi,
|
||||
|
||||
@@ -4,11 +4,18 @@ export const queryKeys = {
|
||||
albums: {
|
||||
detail: (albumId: string) => ['albums', albumId] as const,
|
||||
list: (serverId: string, params: AlbumListParams) =>
|
||||
['albums', 'list', serverId, params] as const,
|
||||
[serverId, 'albums', 'list', params] as const,
|
||||
root: ['albums'],
|
||||
songList: (albumId: string) => ['albums', albumId, 'songs'] as const,
|
||||
},
|
||||
genres: {
|
||||
list: (serverId: string) => [serverId, 'genres', 'list'] as const,
|
||||
root: (serverId: string) => [serverId, 'genres'] as const,
|
||||
},
|
||||
ping: (url: string) => ['ping', url] as const,
|
||||
server: {
|
||||
root: (serverId: string) => [serverId] as const,
|
||||
},
|
||||
servers: {
|
||||
list: (params?: any) => ['servers', 'list', params] as const,
|
||||
root: ['servers'],
|
||||
|
||||
@@ -174,10 +174,13 @@ export type Ping = {
|
||||
};
|
||||
|
||||
export type Genre = {
|
||||
createdAt: string;
|
||||
albumArtistCount: number;
|
||||
albumCount: number;
|
||||
artistCount: number;
|
||||
id: string;
|
||||
name: string;
|
||||
updatedAt: string;
|
||||
songCount: number;
|
||||
totalCount: number;
|
||||
};
|
||||
|
||||
export type RelatedGenre = {
|
||||
|
||||
Reference in New Issue
Block a user