MCPcopy
hub / github.com/srcbookdev/srcbook / createSession

Function createSession

packages/web/src/lib/server.ts:147–162  ·  view source on GitHub ↗
(
  request: CreateSessionRequestType,
)

Source from the content-addressed store, hash-verified

145}
146
147export async function createSession(
148 request: CreateSessionRequestType,
149): Promise<CreateSessionResponseType> {
150 const response = await fetch(API_BASE_URL + '/sessions', {
151 method: 'POST',
152 headers: { 'content-type': 'application/json' },
153 body: JSON.stringify(request),
154 });
155
156 if (!response.ok) {
157 console.error(response);
158 throw new Error('Request failed');
159 }
160
161 return response.json();
162}
163
164interface LoadSessionRequestType {
165 id: string;

Callers 6

DragAndDropSrcmdModalFunction · 0.90
onCreateSrcbookFromUrlFunction · 0.90
openSrcbookFunction · 0.90
openSrcbookFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected