Skip to content

Commit

Permalink
Merge pull request #133 from minrk/token
Browse files Browse the repository at this point in the history
include access token in client requests, if defined
  • Loading branch information
axelboc authored Apr 19, 2024
2 parents 329c874 + 41d2046 commit 50e2a66
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/H5webApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ function TwoRenderApp() {

function H5webApp(props: { filePath: string }) {
const { filePath } = props;
const { baseUrl } = ServerConnection.makeSettings();
const { baseUrl, token } = ServerConnection.makeSettings();

const axiosConfig = useMemo(
() => ({ params: { file: filePath } }),
[filePath]
() => ({
params: { file: filePath },
headers: token ? { Authorization: `token ${token}` } : {},
}),
[filePath, token]
);

return (
Expand Down

0 comments on commit 50e2a66

Please sign in to comment.