fix(bi): use correct auth token key for cost-config API calls
Fixed authentication issue where loadCostConfig() and saveCostConfig() were using wrong localStorage key 'tractatus_token' instead of 'admin_token' (accessed via getAuthToken()). This caused "jwt malformed" 401 errors because: - audit-logs endpoint: uses admin_token (works ✓) - cost-config endpoint: was using tractatus_token (broken ✗) Changed both functions to use getAuthToken() for consistency. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
5a559ceaeb
commit
20d813a88c
1 changed files with 2 additions and 2 deletions
|
|
@ -903,7 +903,7 @@ function showError(message) {
|
||||||
// Cost Configuration
|
// Cost Configuration
|
||||||
async function loadCostConfig() {
|
async function loadCostConfig() {
|
||||||
try {
|
try {
|
||||||
const token = localStorage.getItem('tractatus_token');
|
const token = getAuthToken();
|
||||||
const response = await fetch('/api/admin/cost-config', {
|
const response = await fetch('/api/admin/cost-config', {
|
||||||
headers: { 'Authorization': `Bearer ${token}` }
|
headers: { 'Authorization': `Bearer ${token}` }
|
||||||
});
|
});
|
||||||
|
|
@ -922,7 +922,7 @@ async function loadCostConfig() {
|
||||||
|
|
||||||
async function saveCostConfig(costFactors) {
|
async function saveCostConfig(costFactors) {
|
||||||
try {
|
try {
|
||||||
const token = localStorage.getItem('tractatus_token');
|
const token = getAuthToken();
|
||||||
const response = await fetch('/api/admin/cost-config', {
|
const response = await fetch('/api/admin/cost-config', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue