mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 12:30:12 +02:00
29 lines
669 B
TypeScript
29 lines
669 B
TypeScript
import { api } from '../lib';
|
|
import { AlbumResponse, AlbumsResponse, BasePaginationRequest } from './types';
|
|
|
|
export interface AlbumsRequest extends BasePaginationRequest {
|
|
orderBy: string;
|
|
serverFolderIds?: string;
|
|
sortBy: string;
|
|
}
|
|
|
|
const getAlbum = async (params: { id: number }, signal?: AbortSignal) => {
|
|
const { data } = await api.get<AlbumResponse>(`/albums/${params.id}`, {
|
|
signal,
|
|
});
|
|
return data;
|
|
};
|
|
|
|
const getAlbums = async (params: AlbumsRequest, signal?: AbortSignal) => {
|
|
const { data } = await api.get<AlbumsResponse>(`/albums`, {
|
|
params,
|
|
signal,
|
|
});
|
|
return data;
|
|
};
|
|
|
|
export const albumsApi = {
|
|
getAlbum,
|
|
getAlbums,
|
|
};
|