fix: Use correct token key (studio_token) in admin pages

- Fix localStorage token key from 'token' to 'studio_token'
- Add debug logging for token authentication
- Add automatic redirect to login on 401
- Add error messages for missing/expired tokens

Affected pages:
- /admin/token-usage
- /admin/users
- /admin

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
2026-03-23 17:32:08 -03:00
parent dce68d76df
commit 995065df4f
3 changed files with 26 additions and 6 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ export default function UsersPage() {
`${process.env.NEXT_PUBLIC_CMS_API_URL || 'http://localhost:3001'}/admin/users/${user.id}/token-limit/check`,
{
headers: {
'Authorization': `Bearer ${localStorage.getItem('token')}`,
'Authorization': `Bearer ${localStorage.getItem('studio_token')}`,
},
}
);