mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-21 00:49:17 +01:00
Switch to Preact!!!
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { invoke } from '@tauri-apps/api';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { route } from 'preact-router';
|
||||
import type { HttpRequest } from '../lib/models';
|
||||
import { convertDates } from '../lib/models';
|
||||
import { responsesQueryKey } from './useResponses';
|
||||
@@ -44,13 +44,12 @@ export function useRequestCreate({
|
||||
workspaceId: string;
|
||||
navigateAfter: boolean;
|
||||
}) {
|
||||
const navigate = useNavigate();
|
||||
return useMutation<string, unknown, Pick<HttpRequest, 'name'>>({
|
||||
mutationFn: async (patch) => invoke('create_request', { ...patch, workspaceId }),
|
||||
onSuccess: async (requestId) => {
|
||||
console.log('DONE', { requestId, navigateAfter });
|
||||
if (navigateAfter) {
|
||||
navigate(`/workspaces/${workspaceId}/requests/${requestId}`);
|
||||
route(`/workspaces/${workspaceId}/requests/${requestId}`);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user