Skip to content

Commit 0e5cdfa

Browse files
author
Hanzo Dev
committed
fix: Add null check for finalOptions.headers in api-client
- Fixed TypeScript error where finalOptions.headers could be undefined - Added check before accessing headers['Authorization'] - Resolves production build failure
1 parent 043071b commit 0e5cdfa

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/api-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class ApiClient {
127127
// Add auth token if available
128128
if (typeof window !== 'undefined') {
129129
const token = localStorage.getItem('auth_token');
130-
if (token && !finalOptions.headers['Authorization']) {
130+
if (token && finalOptions.headers && !finalOptions.headers['Authorization']) {
131131
finalOptions.headers['Authorization'] = `Bearer ${token}`;
132132
}
133133
}

0 commit comments

Comments
 (0)