mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-02-23 02:54:58 +01:00
New sidebar and folder view (#263)
This commit is contained in:
@@ -1,19 +1,38 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import { Workspace } from '../../../components/Workspace';
|
||||
|
||||
interface WorkspaceSearchSchema {
|
||||
request_id?: string | null;
|
||||
type WorkspaceSearchSchema = {
|
||||
environment_id?: string | null;
|
||||
cookie_jar_id?: string | null;
|
||||
}
|
||||
} & (
|
||||
| {
|
||||
request_id: string;
|
||||
}
|
||||
| {
|
||||
folder_id: string;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
||||
| {}
|
||||
);
|
||||
|
||||
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,
|
||||
}),
|
||||
validateSearch: (search: Record<string, unknown>): WorkspaceSearchSchema => {
|
||||
const base: Pick<WorkspaceSearchSchema, 'environment_id' | 'cookie_jar_id'> = {
|
||||
environment_id: search.environment_id as string,
|
||||
cookie_jar_id: search.cookie_jar_id as string,
|
||||
};
|
||||
|
||||
const requestId = search.request_id as string | undefined;
|
||||
const folderId = search.folder_id as string | undefined;
|
||||
if (requestId != null) {
|
||||
return { ...base, request_id: requestId };
|
||||
} else if (folderId) {
|
||||
return { ...base, folder_id: folderId };
|
||||
} else {
|
||||
return base;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
function RouteComponent() {
|
||||
|
||||
Reference in New Issue
Block a user