blob: ca38be89b1d0cb2af1cd5420104c47c8e0994cf4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import { Actor } from "@opencode/cloud-core/actor.js"
import { getActor } from "./auth"
import { query } from "@solidjs/router"
export async function withActor<T>(fn: () => T) {
const actor = await getActor()
return Actor.provide(actor.type, actor.properties, fn)
}
export function actorQuery<T>(cb: () => T, name: string) {
"use server"
return query(async () => {
const actor = await getActor()
return withActor(cb)
}, name)
}
|