fix: use correct token key for CSV download auth
All checks were successful
Deploy Admin Frontend / build-and-deploy (push) Successful in 10s
All checks were successful
Deploy Admin Frontend / build-and-deploy (push) Successful in 10s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
4b14178574
commit
8795b4d045
@ -2,6 +2,7 @@ import { Card, Button, Space, Typography, Table, message, Select } from 'antd'
|
||||
import { DownloadOutlined } from '@ant-design/icons'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { api } from '@/services/http-client'
|
||||
import { getAccessToken } from '@/services/token-store'
|
||||
import { useState } from 'react'
|
||||
|
||||
const { Title } = Typography
|
||||
@ -25,7 +26,7 @@ export default function ReportingAdmin() {
|
||||
const download = async (type: string) => {
|
||||
try {
|
||||
const res = await fetch(`/admin-api/reporting/export/${type}?days=${days}`, {
|
||||
headers: { Authorization: `Bearer ${localStorage.getItem('accessToken') || ''}` },
|
||||
headers: { Authorization: `Bearer ${getAccessToken() || ''}` },
|
||||
})
|
||||
if (!res.ok) throw new Error('下载失败')
|
||||
const text = await res.text()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user