feat: auth & admin
This commit is contained in:
@@ -3,11 +3,20 @@ import type { DownloadJob } from '../types';
|
||||
|
||||
export const downloadsApi = api.injectEndpoints({
|
||||
endpoints: (build) => ({
|
||||
getDownloads: build.query<DownloadJob[], { status?: DownloadJob['status'] } | void>({
|
||||
getDownloads: build.query<
|
||||
DownloadJob[],
|
||||
{ status?: DownloadJob['status'] } | void
|
||||
>({
|
||||
query: (params) => ({ url: '/downloads', params: params ?? {} }),
|
||||
providesTags: ['Download'],
|
||||
}),
|
||||
addDownload: build.mutation<DownloadJob, { url: string; metadata?: { title?: string; artist?: string; album?: string } }>({
|
||||
addDownload: build.mutation<
|
||||
DownloadJob,
|
||||
{
|
||||
url: string;
|
||||
metadata?: { title?: string; artist?: string; album?: string };
|
||||
}
|
||||
>({
|
||||
query: (body) => ({ url: '/downloads', method: 'POST', body }),
|
||||
invalidatesTags: ['Download'],
|
||||
}),
|
||||
@@ -23,4 +32,9 @@ export const downloadsApi = api.injectEndpoints({
|
||||
overrideExisting: false,
|
||||
});
|
||||
|
||||
export const { useGetDownloadsQuery, useAddDownloadMutation, useCancelDownloadMutation, useRetryDownloadMutation } = downloadsApi;
|
||||
export const {
|
||||
useGetDownloadsQuery,
|
||||
useAddDownloadMutation,
|
||||
useCancelDownloadMutation,
|
||||
useRetryDownloadMutation,
|
||||
} = downloadsApi;
|
||||
|
||||
Reference in New Issue
Block a user