Skip to content

Commit

Permalink
Merge pull request #343 from CommandDash/fix-contribute-source-for-cu…
Browse files Browse the repository at this point in the history
…stom-agents

fix: included auth header for custom agents contribute source
  • Loading branch information
samyakkkk authored Oct 21, 2024
2 parents afbb12c + 3307073 commit bc5b51c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions web/src/lib/components/SettingsAgent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@
return;
}
let accessToken = localStorage.getItem("accessToken");
const headers = {
"Content-Type": "application/json",
};
if (accessToken && accessToken.length > 0) {
headers.Authorization = "Bearer " + accessToken;
}
for (let field of formData) {
const [key, value] = field;
Expand All @@ -57,9 +67,7 @@
try {
const response = await fetch(ACTION_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
headers: headers,
body: JSON.stringify(requestBody),
});
Expand Down

0 comments on commit bc5b51c

Please sign in to comment.