mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-21 08:59:07 +01:00
Add .oxfmtignore to skip generated bindings and wasm-pack output. Add npm format script, update DEVELOPMENT.md for Vite+ toolchain, and format all non-generated files with oxfmt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { createFastMutation } from "../hooks/useFastMutation";
|
|
import { getRecentCookieJars } from "../hooks/useRecentCookieJars";
|
|
import { getRecentEnvironments } from "../hooks/useRecentEnvironments";
|
|
import { getRecentRequests } from "../hooks/useRecentRequests";
|
|
import { router } from "../lib/router";
|
|
import { invokeCmd } from "../lib/tauri";
|
|
|
|
export const switchWorkspace = createFastMutation<
|
|
void,
|
|
unknown,
|
|
{
|
|
workspaceId: string;
|
|
inNewWindow: boolean;
|
|
}
|
|
>({
|
|
mutationKey: ["open_workspace"],
|
|
mutationFn: async ({ workspaceId, inNewWindow }) => {
|
|
const environmentId = (await getRecentEnvironments(workspaceId))[0] ?? undefined;
|
|
const requestId = (await getRecentRequests(workspaceId))[0] ?? undefined;
|
|
const cookieJarId = (await getRecentCookieJars(workspaceId))[0] ?? undefined;
|
|
const search = {
|
|
environment_id: environmentId,
|
|
cookie_jar_id: cookieJarId,
|
|
request_id: requestId,
|
|
};
|
|
|
|
if (inNewWindow) {
|
|
const location = router.buildLocation({
|
|
to: "/workspaces/$workspaceId",
|
|
params: { workspaceId },
|
|
search,
|
|
});
|
|
await invokeCmd<void>("cmd_new_main_window", { url: location.href });
|
|
return;
|
|
}
|
|
|
|
await router.navigate({
|
|
to: "/workspaces/$workspaceId",
|
|
params: { workspaceId },
|
|
search,
|
|
});
|
|
},
|
|
});
|