mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-17 23:13:51 +01:00
Remove useNavigate everywhere, and make request a query param. And convert dialog to Jotai
This commit is contained in:
@@ -1,19 +1,21 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import { Workspace } from '../../../components/Workspace';
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { Workspace } from '../../../components/Workspace'
|
||||
|
||||
interface WorkspaceSearchSchema {
|
||||
cookie_jar_id?: string | null;
|
||||
environment_id?: string | null;
|
||||
request_id?: string | null
|
||||
environment_id?: string | null
|
||||
cookie_jar_id?: string | null
|
||||
}
|
||||
|
||||
export const Route = createFileRoute('/workspaces/$workspaceId/')({
|
||||
component: RouteComponent,
|
||||
validateSearch: (search: Record<string, unknown>): WorkspaceSearchSchema => ({
|
||||
request_id: search.request_id as string,
|
||||
environment_id: search.environment_id as string,
|
||||
cookie_jar_id: search.cookie_jar_id as string,
|
||||
}),
|
||||
});
|
||||
})
|
||||
|
||||
function RouteComponent() {
|
||||
return <Workspace />;
|
||||
return <Workspace />
|
||||
}
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import { Workspace } from '../../../../components/Workspace';
|
||||
import { createFileRoute, Navigate, useParams } from '@tanstack/react-router'
|
||||
|
||||
export const Route = createFileRoute('/workspaces/$workspaceId/requests/$requestId')({
|
||||
// -----------------------------------------------------------------------------------
|
||||
// IMPORTANT: This is a deprecated route. Since the active request is optional, it was
|
||||
// moved from a path param to a query parameter. This route does a redirect to the
|
||||
// parent, while preserving the active request.
|
||||
|
||||
export const Route = createFileRoute(
|
||||
'/workspaces/$workspaceId/requests/$requestId',
|
||||
)({
|
||||
component: RouteComponent,
|
||||
});
|
||||
})
|
||||
|
||||
function RouteComponent() {
|
||||
return <Workspace />;
|
||||
const { workspaceId, requestId } = useParams({
|
||||
from: '/workspaces/$workspaceId/requests/$requestId',
|
||||
})
|
||||
return (
|
||||
<Navigate
|
||||
to="/workspaces/$workspaceId"
|
||||
params={{ workspaceId }}
|
||||
search={(prev) => ({ ...prev, requestId })}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user