11import consola from "consola"
22import { FetchError , ofetch } from "ofetch"
33
4+ import { COPILOT_CONFIG , GITHUB_CONFIG , GITHUB_WEB_CONFIG } from "~/config/api"
45import { TOKENS } from "~/config/tokens"
56
67export const copilot = ofetch . create ( {
7- baseURL : "https://api.individual.githubcopilot.com" ,
8- headers : {
9- "copilot-integration-id" : "vscode-chat" ,
10- } ,
8+ baseURL : COPILOT_CONFIG . baseURL ,
9+ headers : COPILOT_CONFIG . headers ,
1110
1211 onRequest ( { options } ) {
1312 options . headers . set ( "authorization" , `Bearer ${ TOKENS . COPILOT_TOKEN } ` )
@@ -33,7 +32,7 @@ export const copilot = ofetch.create({
3332} )
3433
3534export const github = ofetch . create ( {
36- baseURL : "https://api.github.com" ,
35+ baseURL : GITHUB_CONFIG . baseURL ,
3736
3837 onRequest ( { options } ) {
3938 options . headers . set ( "authorization" , `token ${ TOKENS . GITHUB_TOKEN } ` )
@@ -42,5 +41,5 @@ export const github = ofetch.create({
4241
4342// Only used for device flow auth
4443export const _github = ofetch . create ( {
45- baseURL : "https://github.com" ,
44+ baseURL : GITHUB_WEB_CONFIG . baseURL ,
4645} )
0 commit comments