更新文档和文件上传功能,新增前端JWT传递逻辑,优化用户信息处理。
This commit is contained in:
@@ -38,7 +38,7 @@ export const meta: MetaFunction = () => {
|
||||
export const loader = async ({ request }: LoaderFunctionArgs) => {
|
||||
// 获取用户会话信息
|
||||
const { getUserSession } = await import("~/api/login/auth.server");
|
||||
const { userInfo } = await getUserSession(request);
|
||||
const { userInfo, frontendJWT } = await getUserSession(request);
|
||||
|
||||
// 获取URL查询参数,只保留必要的分页参数
|
||||
const url = new URL(request.url);
|
||||
@@ -61,6 +61,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
|
||||
pageSize,
|
||||
documentTypeOptions,
|
||||
userInfo, // 传递用户信息到客户端
|
||||
frontendJWT, // 传递前端JWT到客户端
|
||||
initialLoad: true // 标记这是初始加载
|
||||
});
|
||||
};
|
||||
@@ -793,7 +794,7 @@ export default function DocumentsIndex() {
|
||||
attachmentMergeMode,
|
||||
true, // isReprocess
|
||||
attachmentRemark || undefined,
|
||||
loaderData.userInfo?.token as string | undefined
|
||||
loaderData.frontendJWT as string | undefined
|
||||
);
|
||||
|
||||
if (result.error) {
|
||||
@@ -865,7 +866,7 @@ export default function DocumentsIndex() {
|
||||
templateFile,
|
||||
selectedDocumentId,
|
||||
undefined, // comparisonId
|
||||
loaderData.userInfo?.token as string | undefined
|
||||
loaderData.frontendJWT as string | undefined
|
||||
);
|
||||
|
||||
if (result.error) {
|
||||
|
||||
@@ -921,7 +921,7 @@ export default function FilesUpload() {
|
||||
attachmentMergeMode,
|
||||
true, // isReprocess
|
||||
attachmentRemark || undefined,
|
||||
loaderData.userInfo?.token as string | undefined
|
||||
loaderData.frontendJWT as string | undefined
|
||||
);
|
||||
|
||||
if (result.error) {
|
||||
@@ -991,7 +991,7 @@ export default function FilesUpload() {
|
||||
templateFile,
|
||||
selectedDocumentId,
|
||||
undefined, // comparisonId
|
||||
loaderData.userInfo?.token as string | undefined
|
||||
loaderData.frontendJWT as string | undefined
|
||||
);
|
||||
|
||||
if (result.error) {
|
||||
|
||||
Reference in New Issue
Block a user