Browse Source

ignore: fix type errors

Dax Raad 8 months ago
parent
commit
7050cc0ac3
1 changed files with 4 additions and 4 deletions
  1. 4 4
      packages/opencode/src/provider/provider.ts

+ 4 - 4
packages/opencode/src/provider/provider.ts

@@ -86,17 +86,17 @@ export namespace Provider {
         options: {
         options: {
           apiKey: "",
           apiKey: "",
           async fetch(input: any, init: any) {
           async fetch(input: any, init: any) {
-            let info = await Auth.get("github-copilot")
+            const info = await Auth.get("github-copilot")
             if (!info || info.type !== "oauth") return
             if (!info || info.type !== "oauth") return
             if (!info.access || info.expires < Date.now()) {
             if (!info.access || info.expires < Date.now()) {
               const tokens = await copilot.access(info.refresh)
               const tokens = await copilot.access(info.refresh)
               if (!tokens)
               if (!tokens)
                 throw new Error("GitHub Copilot authentication expired")
                 throw new Error("GitHub Copilot authentication expired")
-              info = {
+              await Auth.set("github-copilot", {
                 type: "oauth",
                 type: "oauth",
                 ...tokens,
                 ...tokens,
-              }
-              await Auth.set("github-copilot", info)
+              })
+              info.access = tokens.access
             }
             }
             const headers = {
             const headers = {
               ...init.headers,
               ...init.headers,