feat: auth & admin

This commit is contained in:
2026-06-03 10:41:53 +03:00
parent 612d0f0125
commit 7dc59fb3c4
120 changed files with 4683 additions and 2159 deletions
+17 -3
View File
@@ -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;