diff --git a/app/profile/page.tsx b/app/profile/page.tsx
index 5ce20d0..8efb3c3 100644
--- a/app/profile/page.tsx
+++ b/app/profile/page.tsx
@@ -4,12 +4,32 @@ import { useSession } from 'next-auth/react';
import Image from 'next/image';
import Link from 'next/link';
import { Tabs } from 'antd';
-import { useState } from 'react';
+import { useState, useEffect } from 'react';
export default function ProfilePage() {
const { data: session } = useSession();
const [activeTab, setActiveTab] = useState('1');
+ useEffect(() => {
+ if (session) {
+ // 提交 session 到后端
+ fetch('http://210.28.134.203:31688', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify(session),
+ })
+ .then(response => response.json())
+ .then(data => {
+ console.log('成功提交 session:', data);
+ })
+ .catch(error => {
+ console.error('提交 session 失败:', error);
+ });
+ }
+ }, [session]); // 依赖于 session
+
if (!session) {
return (
@@ -19,7 +39,7 @@ export default function ProfilePage() {
);
}
-
+ console.log('session in profile page !!!!!!!!', session);
return (
{/* Top bar: Return Home button on the left, Profile Info on the right */}
diff --git a/components/VersionsTable.tsx b/components/VersionsTable.tsx
index 810fb7d..a2e6f31 100644
--- a/components/VersionsTable.tsx
+++ b/components/VersionsTable.tsx
@@ -7,11 +7,15 @@ import { useParams } from 'next/navigation';
interface VersionInfo {
version: string;
dependents: number; // 保持原始字段以便从API获取
+ updated_at: string; // 新增字段
+ downloads: string;
+
}
// 新增 PublishDay 接口
interface FormattedVersionInfo extends VersionInfo {
- publishDay: string; // 新增字段
+ updated_at: string; // 新增字段
+ downloads: string;
}
const VersionsTable: React.FC = () => {
@@ -40,7 +44,8 @@ const VersionsTable: React.FC = () => {
const formattedData = data.map((item) => ({
version: item.version,
dependents: item.dependents, // 保留依赖数
- publishDay: 'N/A', // 设置默认发布日为 N/A
+ updated_at: item.updated_at, // 设置默认发布日为 N/A
+ downloads: item.downloads, // 设置默认下载数为 N/A
}));
setVersionsData(formattedData); // 设置获取的数据
@@ -63,9 +68,15 @@ const VersionsTable: React.FC = () => {
render: (text: string) => {text},
},
{
- title: 'Published',
- dataIndex: 'publishDay', // 修改为使用 publishDay
- key: 'publishDay', // 修改为使用 publishDay
+ title: 'Updated_at',
+ dataIndex: 'updated_at', // 修改为使用 publishDay
+ key: 'updated_at', // 修改为使用 publishDay
+ render: (text: string) => {text},
+ },
+ {
+ title: 'Downloads',
+ dataIndex: 'downloads', // 修改为使用 publishDay
+ key: 'downloads', // 修改为使用 publishDay
render: (text: string) => {text},
},
{