mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-05 12:21:39 +00:00
Implement Navidrome sharing (#575)
* add share item feature * take care of (mostly) everything * bugfixes * allow clicking on notification to open url * readd the missing modal after router migration * remove unnecessary extension --------- Co-authored-by: Kendall Garner <17521368+kgarner7@users.noreply.github.com>
This commit is contained in:
parent
0d03b66fe5
commit
cb2597d2c8
14 changed files with 303 additions and 4 deletions
|
|
@ -0,0 +1,24 @@
|
|||
import { useMutation } from '@tanstack/react-query';
|
||||
import { AnyLibraryItems, ShareItemResponse, ShareItemArgs } from '/@/renderer/api/types';
|
||||
import { AxiosError } from 'axios';
|
||||
import { api } from '/@/renderer/api';
|
||||
import { MutationHookArgs } from '/@/renderer/lib/react-query';
|
||||
import { getServerById } from '/@/renderer/store';
|
||||
|
||||
export const useShareItem = (args: MutationHookArgs) => {
|
||||
const { options } = args || {};
|
||||
|
||||
return useMutation<
|
||||
ShareItemResponse,
|
||||
AxiosError,
|
||||
Omit<ShareItemArgs, 'server' | 'apiClientProps'>,
|
||||
{ previous: { items: AnyLibraryItems } | undefined }
|
||||
>({
|
||||
mutationFn: (args) => {
|
||||
const server = getServerById(args.serverId);
|
||||
if (!server) throw new Error('Server not found');
|
||||
return api.controller.shareItem({ ...args, apiClientProps: { server } });
|
||||
},
|
||||
...options,
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue