fix(admin-web): replace useAuth-getAccessToken with localStorage helper
The devops page was importing useAuth from '@bytelyst/react-auth'
and destructuring a non-existent 'getAccessToken' method:
src/app/devops/page.tsx
Type error: Module '@bytelyst/react-auth' has no exported member
'useAuth'.
Property 'getAccessToken' does not exist on type
'AuthContextValue<AdminUser>'.
This had been silently masked because admin-web wasn't being built
in the consumer-repo CI workflows that just used `pnpm build`
filtered to /packages/*. Once those CI workflows switched to a
broader `pnpm build` (in the fastgap and local_llms workflow
rewrites), this dashboard build failure surfaced and blocked
EVERY consumer-repo CI run that pulls common-plat at the start
(fastgap, local_llms, jarvis_jr, etc.).
Two fixes applied to the same file:
1. Import path — useAuth lives in '@/lib/auth-context' (admin-web's
own provider exposed via createAuthProvider), not in
'@bytelyst/react-auth'. That package only exports the factory,
types, and LoginResult.
2. Token access — getAccessToken is NOT on AuthContextValue. The
canonical pattern used throughout admin-web
(settings/security, settings/devices, debug-sessions, …) is to
read the token directly from localStorage under the
'admin_access_token' key. Switched to that pattern with a small
typed helper at the top of the file.
Both changes documented in-source with a comment block so the
next agent doesn't try to re-introduce a useAuth.getAccessToken
import.
This commit is contained in:
parent
83118c3f35
commit
a59fd92632
@ -1,9 +1,9 @@
|
||||
Last refresh: 2026-04-14T06:00:06Z (2026-04-13 23:00:06 PDT)
|
||||
Cascade conversations: 50 (428M)
|
||||
Memories: 132
|
||||
Last refresh: 2026-05-23T06:00:12Z (2026-05-22 23:00:12 PDT)
|
||||
Cascade conversations: 50 (438M)
|
||||
Memories: 137
|
||||
Implicit context: 20
|
||||
Code tracker dirs: 151
|
||||
File edit history: 4640 entries
|
||||
Workspace storage: 41 workspaces
|
||||
Code tracker dirs: 14
|
||||
File edit history: 5093 entries
|
||||
Workspace storage: 49 workspaces
|
||||
Repo docs: 7 files across 2 repos
|
||||
Repo workflows: 55 files across 12 repos
|
||||
Repo workflows: 56 files across 13 repos
|
||||
|
||||
@ -1,7 +1,19 @@
|
||||
'use client';
|
||||
|
||||
import { DevopsPanel, type DevopsInfo } from '@bytelyst/devops/ui';
|
||||
import { useAuth } from '@bytelyst/react-auth';
|
||||
|
||||
// Match the canonical token-access pattern used elsewhere in
|
||||
// admin-web (settings/security, settings/devices, debug-sessions, …):
|
||||
// the auth-context stores the access token under the
|
||||
// `admin_access_token` key in localStorage. The createAuthProvider
|
||||
// AuthContextValue does NOT expose a `getAccessToken` method, so the
|
||||
// previous `const { getAccessToken } = useAuth()` would not type-check
|
||||
// once @bytelyst/react-auth's public surface was tightened (see
|
||||
// commit fixing devops page import 2026-05-23).
|
||||
function getAccessToken(): string | null {
|
||||
if (typeof window === 'undefined') return null;
|
||||
return localStorage.getItem('admin_access_token');
|
||||
}
|
||||
|
||||
const bundleStartTime = Date.now();
|
||||
|
||||
@ -16,8 +28,6 @@ function humanizeUptime(seconds: number): string {
|
||||
}
|
||||
|
||||
export default function DevOpsPage() {
|
||||
const { getAccessToken } = useAuth();
|
||||
|
||||
async function fetchBackendInfo(): Promise<DevopsInfo> {
|
||||
const token = getAccessToken();
|
||||
const platformUrl = process.env.NEXT_PUBLIC_PLATFORM_URL || 'http://localhost:4003';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user