summaryrefslogtreecommitdiffhomepage
path: root/packages/console/app/src/context/auth.withActor.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/console/app/src/context/auth.withActor.ts')
-rw-r--r--packages/console/app/src/context/auth.withActor.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/console/app/src/context/auth.withActor.ts b/packages/console/app/src/context/auth.withActor.ts
new file mode 100644
index 000000000..2cb970269
--- /dev/null
+++ b/packages/console/app/src/context/auth.withActor.ts
@@ -0,0 +1,7 @@
+import { Actor } from "@opencode/console-core/actor.js"
+import { getActor } from "./auth"
+
+export async function withActor<T>(fn: () => T, workspace?: string) {
+ const actor = await getActor(workspace)
+ return Actor.provide(actor.type, actor.properties, fn)
+}