-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Change checkbox to circle * Add startIcon to input component * Add series api to rtkq * Fix series breakdown on dashboard * Migrate some file apis to rtkq * Migrate more file apis to rtkq * Fix eslint * Remove mainpage refresh event * Fix signalr * Change avdump trigger to async/await * Take avdump result from trigger response
- Loading branch information
1 parent
872fff1
commit 767e67b
Showing
22 changed files
with
201 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'; | ||
|
||
import type { RootState } from '../store'; | ||
import type { FileType, AVDumpResultType } from '../types/api/file'; | ||
import type { ListResultType, PaginationType } from '../types/api'; | ||
|
||
export const fileApi = createApi({ | ||
reducerPath: 'file', | ||
baseQuery: fetchBaseQuery({ | ||
baseUrl: '/api/v3/File/', | ||
prepareHeaders: (headers, { getState }) => { | ||
const apikey = (getState() as RootState).apiSession.apikey; | ||
headers.set('apikey', apikey); | ||
return headers; | ||
}, | ||
}), | ||
endpoints: build => ({ | ||
|
||
// Get ignored files. | ||
getFileIgnored: build.query<ListResultType<Array<FileType>>, PaginationType>({ | ||
query: params => ({ url: 'Ignored', params }), | ||
}), | ||
|
||
// Get unrecognized files. Shoko.Server.API.v3.Models.Shoko.File.FileDetailed is not relevant here, as there will be no links. Use pageSize and page (index 0) in the query to enable pagination. | ||
getFileUnrecognized: build.query<ListResultType<Array<FileType>>, PaginationType>({ | ||
query: params => ({ url: 'Unrecognized', params }), | ||
}), | ||
|
||
// Mark or unmark a file as ignored. | ||
putFileIgnore: build.query<void, { fileID: number, value: boolean }>({ | ||
query: params => ({ | ||
url: `${params.fileID}/Ignore`, | ||
params, | ||
method: 'PUT', | ||
}), | ||
}), | ||
|
||
// Run a file through AVDump and return the result. | ||
postFileAVDump: build.query<AVDumpResultType, number>({ | ||
query: fileId => ({ | ||
url: `${fileId}/AVDump`, | ||
method: 'POST', | ||
}), | ||
}), | ||
|
||
// Rescan a file on AniDB. | ||
postFileRescan: build.query<void, number>({ | ||
query: fileId => ({ | ||
url: `${fileId}/Rescan`, | ||
method: 'POST', | ||
}), | ||
}), | ||
|
||
// Rehash a file. | ||
postFileRehash: build.query<void, number>({ | ||
query: fileId => ({ | ||
url: `${fileId}/Rehash`, | ||
method: 'POST', | ||
}), | ||
}), | ||
}), | ||
}); | ||
|
||
export const { | ||
useGetFileIgnoredQuery, | ||
useGetFileUnrecognizedQuery, | ||
useLazyPutFileIgnoreQuery, | ||
useLazyPostFileAVDumpQuery, | ||
useLazyPostFileRescanQuery, | ||
useLazyPostFileRehashQuery, | ||
} = fileApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'; | ||
|
||
import type { RootState } from '../store'; | ||
import type { SeriesAniDBSearchResult } from '../types/api/series'; | ||
import type { PaginationType } from '../types/api'; | ||
|
||
export const seriesApi = createApi({ | ||
reducerPath: 'series', | ||
baseQuery: fetchBaseQuery({ | ||
baseUrl: '/api/v3/Series/', | ||
prepareHeaders: (headers, { getState }) => { | ||
const apikey = (getState() as RootState).apiSession.apikey; | ||
headers.set('apikey', apikey); | ||
return headers; | ||
}, | ||
}), | ||
endpoints: build => ({ | ||
|
||
// Search the title dump for the given query or directly using the anidb id. | ||
getSeriesAniDBSearch: build.query<Array<SeriesAniDBSearchResult>, { query: string } & PaginationType>({ | ||
query: params => ({ url: `AniDB/Search/${params.query}`, params }), | ||
transformResponse: (response: any) => response.List, | ||
}), | ||
}), | ||
}); | ||
|
||
export const { | ||
useLazyGetSeriesAniDBSearchQuery, | ||
} = seriesApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.