fix: wait for workspace policy before creation
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { apiFetch } from "./client";
|
||||
import { getSettings } from "./settings";
|
||||
import { workspacePreferences, type WorkspacePreference } from "../workspaces/drafts";
|
||||
import { workspacePolicyGate, workspacePreferences, type WorkspacePreference } from "../workspaces/drafts";
|
||||
import type {
|
||||
Principal, ResumeSessionResult, SessionScope, SessionSummary, SessionDocument, UiResponse,
|
||||
} from "./types";
|
||||
@@ -24,9 +24,11 @@ async function selectedPreferences(): Promise<WorkspacePreference> {
|
||||
|
||||
export async function createSession(i: NewSessionInput) {
|
||||
const preferences = await selectedPreferences();
|
||||
await workspacePolicyGate.waitFor(i.workspaceId ?? preferences.workspaceId);
|
||||
const selection = workspacePreferences.load();
|
||||
return apiFetch<{ id: string }>("/sessions", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ ...preferences, ...i }),
|
||||
body: JSON.stringify({ ...selection, ...i }),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user