Skip to content

Commit

Permalink
Add button for /author/get endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
luminamystere committed Mar 13, 2024
1 parent 6047a6b commit 37a6902
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Fluff4me.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,27 @@ export default class Fluff4me {
}),
});
});

const viewprofilebutton = document.createElement("button");
viewprofilebutton.textContent = "View Profile";
document.body.append(viewprofilebutton);
// eslint-disable-next-line @typescript-eslint/no-misused-promises
viewprofilebutton.addEventListener("click", async () => {
const response = await fetch(`${Env.API_ORIGIN}author/get/chiri`, {
headers: Session.headers(),
}).then(response => response.json());
console.log(response);
});


}
}

namespace Session {
export function headers () {
return Object.fromEntries(Object.entries({
"Session-Token": localStorage.getItem("Session-Token"),
}).filter(([, value]) => value !== null && value !== undefined));
}).filter(([, value]) => value !== null && value !== undefined)) as HeadersInit;
}

export async function refresh () {
Expand Down

0 comments on commit 37a6902

Please sign in to comment.