mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +00:00
fix(achievements): inject Authorization header in plugin API calls
This commit is contained in:
parent
771b8c4a36
commit
da2ed478b5
1 changed files with 3 additions and 1 deletions
|
|
@ -50,7 +50,9 @@
|
|||
|
||||
async function api(path, options) {
|
||||
const url = "/api/plugins/hermes-achievements" + path;
|
||||
const res = await fetch(url, options || {});
|
||||
const token = window.__HERMES_SESSION_TOKEN__ || "";
|
||||
const headers = { ...(options?.headers || {}), Authorization: `Bearer ${token}` };
|
||||
const res = await fetch(url, { ...options, headers });
|
||||
if (!res.ok) {
|
||||
const text = await res.text().catch(function () { return res.statusText; });
|
||||
throw new Error(res.status + ": " + text);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue