给所有请求都加上jwt,隐藏生成jwt的secret(放到.env中),隐藏app-secret(放在pm2运行配置文件中,后续直接读取环境配置即可)
This commit is contained in:
@@ -27,12 +27,13 @@ interface DocumentListModalProps {
|
||||
total?: number;
|
||||
onPageChange?: (page: number) => void;
|
||||
onPageSizeChange?: (size: number) => void;
|
||||
frontendJWT?: string; // 新增JWT参数
|
||||
}
|
||||
|
||||
export function DocumentListModal({
|
||||
isOpen,
|
||||
onClose,
|
||||
title,
|
||||
export function DocumentListModal({
|
||||
isOpen,
|
||||
onClose,
|
||||
title,
|
||||
files,
|
||||
onViewFile,
|
||||
loading = false,
|
||||
@@ -41,7 +42,8 @@ export function DocumentListModal({
|
||||
pageSize = 10,
|
||||
total = 0,
|
||||
onPageChange,
|
||||
onPageSizeChange
|
||||
onPageSizeChange,
|
||||
frontendJWT
|
||||
}: DocumentListModalProps) {
|
||||
// 查看按钮防抖
|
||||
const [isnavigating,setIsnavigating] = useState(false)
|
||||
@@ -58,9 +60,8 @@ export function DocumentListModal({
|
||||
// 检查audit_status是否为0,如果是则更新为2
|
||||
if (auditStatus === 0 || auditStatus === null) {
|
||||
try {
|
||||
// TODO: 不需要传递userId,直接使用fileId找到对应文档,然后更新文档状态
|
||||
// 更新文档状态
|
||||
const updatedFile = await updateDocumentAuditStatus(fileId, 2);
|
||||
// 更新文档状态,传递JWT
|
||||
const updatedFile = await updateDocumentAuditStatus(fileId, 2, frontendJWT);
|
||||
console.log('更新后的文档状态:', updatedFile);
|
||||
} catch (error) {
|
||||
console.error('更新文件审核状态时出错:', error);
|
||||
@@ -68,7 +69,7 @@ export function DocumentListModal({
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 如果有自定义的查看处理函数,则调用它
|
||||
if (onViewFile) {
|
||||
setIsnavigating(true)
|
||||
|
||||
Reference in New Issue
Block a user