mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-20 16:43:53 +01:00
Template Tag Function Editor (#67)

This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import type { GrpcRequest, HttpRequest } from '@yaakapp/api';
|
||||
import React, { useState } from 'react';
|
||||
import { useAppRoutes } from '../hooks/useAppRoutes';
|
||||
import { grpcRequestsQueryKey } from '../hooks/useGrpcRequests';
|
||||
import { httpRequestsQueryKey } from '../hooks/useHttpRequests';
|
||||
import { useUpdateAnyGrpcRequest } from '../hooks/useUpdateAnyGrpcRequest';
|
||||
import { useUpdateAnyHttpRequest } from '../hooks/useUpdateAnyHttpRequest';
|
||||
import { useWorkspaces } from '../hooks/useWorkspaces';
|
||||
import { fallbackRequestName } from '../lib/fallbackRequestName';
|
||||
import type { GrpcRequest, HttpRequest } from '@yaakapp/api';
|
||||
import { Button } from './core/Button';
|
||||
import { InlineCode } from './core/InlineCode';
|
||||
import { Select } from './core/Select';
|
||||
@@ -22,7 +19,6 @@ interface Props {
|
||||
|
||||
export function MoveToWorkspaceDialog({ onDone, request, activeWorkspaceId }: Props) {
|
||||
const workspaces = useWorkspaces();
|
||||
const queryClient = useQueryClient();
|
||||
const updateHttpRequest = useUpdateAnyHttpRequest();
|
||||
const updateGrpcRequest = useUpdateAnyGrpcRequest();
|
||||
const toast = useToast();
|
||||
@@ -52,14 +48,8 @@ export function MoveToWorkspaceDialog({ onDone, request, activeWorkspaceId }: Pr
|
||||
|
||||
if (request.model === 'http_request') {
|
||||
await updateHttpRequest.mutateAsync(args);
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: httpRequestsQueryKey({ workspaceId: activeWorkspaceId }),
|
||||
});
|
||||
} else if (request.model === 'grpc_request') {
|
||||
await updateGrpcRequest.mutateAsync(args);
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: grpcRequestsQueryKey({ workspaceId: activeWorkspaceId }),
|
||||
});
|
||||
}
|
||||
|
||||
// Hide after a moment, to give time for request to disappear
|
||||
|
||||
Reference in New Issue
Block a user