Remove useNavigate everywhere, and make request a query param. And convert dialog to Jotai

This commit is contained in:
Gregory Schier
2025-01-06 16:54:07 -08:00
parent 806a8eb801
commit bc50891edb
54 changed files with 592 additions and 545 deletions

View File

@@ -1,14 +1,13 @@
import type { HttpResponse } from '@yaakapp-internal/models';
import { showAlert } from '../lib/alert';
import { trackEvent } from '../lib/analytics';
import { getHttpRequest } from '../lib/store';
import { invokeCmd } from '../lib/tauri';
import { getActiveCookieJar } from './useActiveCookieJar';
import { getActiveEnvironment } from './useActiveEnvironment';
import { useAlert } from './useAlert';
import { useFastMutation } from './useFastMutation';
export function useSendAnyHttpRequest() {
const alert = useAlert();
return useFastMutation<HttpResponse | null, string, string | null>({
mutationKey: ['send_any_request'],
mutationFn: async (id) => {
@@ -24,6 +23,6 @@ export function useSendAnyHttpRequest() {
});
},
onSettled: () => trackEvent('http_request', 'send'),
onError: (err) => alert({ id: 'send-failed', title: 'Send Failed', body: err }),
onError: (err) => showAlert({ id: 'send-failed', title: 'Send Failed', body: err }),
});
}