Skip to content

Commit 858320d

Browse files
committed
Update openapi-hooks & authentication
1 parent 403160e commit 858320d

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"cx": "^25.3.1",
4242
"date-fns": "^4.1.0",
4343
"leaflet": "^1.9.4",
44-
"openapi-hooks": "0.0.3-alpha.3",
44+
"openapi-hooks": "0.0.6",
4545
"postcss": "^8.5.1",
4646
"postcss-nested": "^7.0.2",
4747
"qrcode.react": "^4.2.0",

web/pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/src/api/api.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@ import { paths } from './schema.gen';
77

88
export const baseUrl = new URL('/api/', window.location.origin);
99

10-
const tokenProxy = {
11-
get value() {
12-
return authStore.getSnapshot().context.token;
13-
},
14-
};
15-
1610
export const useApi = createFetch<paths>({
1711
baseUrl,
18-
get headers() {
12+
async headers() {
13+
const { token } = authStore.getSnapshot().context;
14+
1915
return {
20-
Authorization: `Bearer ${tokenProxy.value}`,
16+
Authorization: `Bearer ${token}`,
2117
};
2218
},
2319
onError(error: { status: number }) {

0 commit comments

Comments
 (0)