MCPcopy
hub / github.com/adrianhajdin/banking / createSessionClient

Function createSessionClient

lib/appwrite.ts:6–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import { cookies } from "next/headers";
5
6export 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
26export async function createAdminClient() {
27 const client = new Client()

Callers 2

getLoggedInUserFunction · 0.90
logoutAccountFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected