()
| 4 | import { cookies } from "next/headers"; |
| 5 | |
| 6 | export async function createSessionClient() { |
| 7 | const client = new Client() |
| 8 | .setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT!) |
| 9 | .setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT!); |
| 10 | |
| 11 | const session = cookies().get("appwrite-session"); |
| 12 | |
| 13 | if (!session || !session.value) { |
| 14 | throw new Error("No session"); |
| 15 | } |
| 16 | |
| 17 | client.setSession(session.value); |
| 18 | |
| 19 | return { |
| 20 | get account() { |
| 21 | return new Account(client); |
| 22 | }, |
| 23 | }; |
| 24 | } |
| 25 | |
| 26 | export async function createAdminClient() { |
| 27 | const client = new Client() |
no outgoing calls
no test coverage detected