Skip to content

Commit bc5b51c

Browse files
authored
Merge pull request #343 from CommandDash/fix-contribute-source-for-custom-agents
fix: included auth header for custom agents contribute source
2 parents afbb12c + 3307073 commit bc5b51c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

web/src/lib/components/SettingsAgent.svelte

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@
3838
return;
3939
}
4040
41+
let accessToken = localStorage.getItem("accessToken");
42+
43+
const headers = {
44+
"Content-Type": "application/json",
45+
};
46+
47+
if (accessToken && accessToken.length > 0) {
48+
headers.Authorization = "Bearer " + accessToken;
49+
}
50+
4151
for (let field of formData) {
4252
const [key, value] = field;
4353
@@ -57,9 +67,7 @@
5767
try {
5868
const response = await fetch(ACTION_URL, {
5969
method: "POST",
60-
headers: {
61-
"Content-Type": "application/json",
62-
},
70+
headers: headers,
6371
body: JSON.stringify(requestBody),
6472
});
6573

0 commit comments

Comments
 (0)