|
1 | | -import { Zero } from "@rocicorp/zero"; |
2 | | -import { useParams } from "@solidjs/router"; |
3 | | -import { schema } from "@opencontrol/zero/schema"; |
4 | | -import { createInitializedContext } from "../../util/context"; |
5 | | -import { useOpenAuth } from "@openauthjs/solid"; |
6 | | -import { useAccount } from "../../components/context-account"; |
7 | | -import { useWorkspace } from "./context-workspace"; |
| 1 | +import { Zero } from "@rocicorp/zero" |
| 2 | +import { useParams } from "@solidjs/router" |
| 3 | +import { schema } from "@opencontrol/zero/schema" |
| 4 | +import { createInitializedContext } from "../../util/context" |
| 5 | +import { useOpenAuth } from "@openauthjs/solid" |
| 6 | +import { useAccount } from "../../components/context-account" |
| 7 | +import { useWorkspace } from "./context-workspace" |
8 | 8 |
|
9 | 9 | export const { use: useZero, provider: ZeroProvider } = |
10 | 10 | createInitializedContext("ZeroContext", () => { |
11 | 11 | const workspace = useWorkspace() |
12 | | - const auth = useOpenAuth(); |
13 | | - const account = useAccount(); |
| 12 | + const auth = useOpenAuth() |
| 13 | + const account = useAccount() |
14 | 14 | const zero = new Zero({ |
15 | 15 | auth: auth.access, |
16 | 16 | server: import.meta.env.VITE_ZERO_URL, |
17 | 17 | userID: account.current!.email, |
18 | 18 | storageKey: workspace.id, |
19 | 19 | schema, |
20 | | - }); |
| 20 | + }) |
21 | 21 |
|
22 | 22 | zero.query.user.where("workspace_id", workspace.id).preload({ |
23 | 23 | ttl: "forever", |
24 | 24 | }) |
25 | 25 | zero.query.workspace.where("id", workspace.id).preload({ |
26 | 26 | ttl: "forever", |
27 | 27 | }) |
| 28 | + zero.query.aws_account.where("workspace_id", workspace.id).preload({ |
| 29 | + ttl: "forever", |
| 30 | + }) |
28 | 31 |
|
29 | 32 | return { |
30 | 33 | mutate: zero.mutate, |
31 | 34 | query: zero.query, |
32 | 35 | ready: true, |
33 | | - }; |
34 | | - }); |
35 | | - |
| 36 | + } |
| 37 | + }) |
0 commit comments