lloydzhou пре 1 година
родитељ
комит
4fdd997108
1 измењених фајлова са 4 додато и 3 уклоњено
  1. 4 3
      app/store/plugin.ts

+ 4 - 3
app/store/plugin.ts

@@ -48,13 +48,14 @@ export const FunctionToolService = {
         : plugin?.authType == "bearer"
         ? ` Bearer ${plugin?.authToken}`
         : plugin?.authToken;
+    const authLocation = plugin?.authLocation || "header";
     const definition = yaml.load(plugin.content) as any;
     const serverURL = definition?.servers?.[0]?.url;
     const baseURL = !!plugin?.usingProxy ? "/api/proxy" : serverURL;
     const headers: Record<string, string | undefined> = {
       "X-Base-URL": !!plugin?.usingProxy ? serverURL : undefined,
     };
-    if (plugin?.authLocation == "header") {
+    if (authLocation == "header") {
       headers[headerName] = tokenValue;
     }
     const api = new OpenAPIClientAxios({
@@ -122,9 +123,9 @@ export const FunctionToolService = {
               delete args[p?.name];
             });
           }
-          if (plugin?.authLocation == "query") {
+          if (authLocation == "query") {
             parameters[headerName] = tokenValue;
-          } else if (plugin?.authLocation == "body") {
+          } else if (authLocation == "body") {
             args[headerName] = tokenValue;
           }
           // @ts-ignore