Multipart form UI and fixes

This commit is contained in:
Gregory Schier
2023-11-14 00:32:02 -08:00
parent a4f5e4a6b8
commit f60cb35b5e
7 changed files with 113 additions and 45 deletions

View File

@@ -3,11 +3,14 @@ import { invoke } from '@tauri-apps/api';
import { trackEvent } from '../lib/analytics';
import type { HttpResponse } from '../lib/models';
import { useActiveEnvironmentId } from './useActiveEnvironmentId';
import { useAlert } from './useAlert';
export function useSendAnyRequest() {
const environmentId = useActiveEnvironmentId();
const alert = useAlert();
return useMutation<HttpResponse, string, string | null>({
mutationFn: (id) => invoke('send_request', { requestId: id, environmentId }),
onSettled: () => trackEvent('http_request', 'send'),
onError: (err) => alert({ title: 'Export Failed', body: err }),
});
}