mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-20 08:33:52 +01:00
Dynamic plugins (#68)
This commit is contained in:
13
src-web/hooks/useCreatePlugin.ts
Normal file
13
src-web/hooks/useCreatePlugin.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { trackEvent } from '../lib/analytics';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
|
||||
export function useCreatePlugin() {
|
||||
return useMutation<void, unknown, string>({
|
||||
mutationKey: ['create_plugin'],
|
||||
mutationFn: async (directory: string) => {
|
||||
await invokeCmd('cmd_create_plugin', { directory });
|
||||
},
|
||||
onSettled: () => trackEvent('plugin', 'create'),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user