()
| 7 | import { HTTPError } from "~/lib/error" |
| 8 | |
| 9 | export async function getDeviceCode(): Promise<DeviceCodeResponse> { |
| 10 | const response = await fetch(`${GITHUB_BASE_URL}/login/device/code`, { |
| 11 | method: "POST", |
| 12 | headers: standardHeaders(), |
| 13 | body: JSON.stringify({ |
| 14 | client_id: GITHUB_CLIENT_ID, |
| 15 | scope: GITHUB_APP_SCOPES, |
| 16 | }), |
| 17 | }) |
| 18 | |
| 19 | if (!response.ok) throw new HTTPError("Failed to get device code", response) |
| 20 | |
| 21 | return (await response.json()) as DeviceCodeResponse |
| 22 | } |
| 23 | |
| 24 | export interface DeviceCodeResponse { |
| 25 | device_code: string |
no test coverage detected
searching dependent graphs…