( request: CreateSessionRequestType, )
| 145 | } |
| 146 | |
| 147 | export 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 | |
| 164 | interface LoadSessionRequestType { |
| 165 | id: string; |
no outgoing calls
no test coverage detected