From f69d79a0ffd2ab8c359d481ff7f79b35243bcc75 Mon Sep 17 00:00:00 2001 From: tone Date: Wed, 17 Dec 2025 15:35:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0user/me=E5=B0=81?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/frontend/lib/api/client.ts | 3 ++- apps/frontend/lib/api/endpoints/user.client.ts | 6 ++++++ apps/frontend/lib/api/endpoints/user.server.ts | 6 ++++++ apps/frontend/lib/api/server.ts | 3 ++- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 apps/frontend/lib/api/endpoints/user.client.ts create mode 100644 apps/frontend/lib/api/endpoints/user.server.ts diff --git a/apps/frontend/lib/api/client.ts b/apps/frontend/lib/api/client.ts index 4ab1ff5..70130f6 100644 --- a/apps/frontend/lib/api/client.ts +++ b/apps/frontend/lib/api/client.ts @@ -45,4 +45,5 @@ export async function clientFetch( -export * as AuthAPI from './endpoints/auth.client' \ No newline at end of file +export * as AuthAPI from './endpoints/auth.client' +export * as UserAPI from './endpoints/user.client' \ No newline at end of file diff --git a/apps/frontend/lib/api/endpoints/user.client.ts b/apps/frontend/lib/api/endpoints/user.client.ts new file mode 100644 index 0000000..84d9cd4 --- /dev/null +++ b/apps/frontend/lib/api/endpoints/user.client.ts @@ -0,0 +1,6 @@ +import { User } from "@/lib/types/user"; +import { clientFetch } from "../client"; + +export async function me() { + return clientFetch('/api/user/me'); +} \ No newline at end of file diff --git a/apps/frontend/lib/api/endpoints/user.server.ts b/apps/frontend/lib/api/endpoints/user.server.ts new file mode 100644 index 0000000..2c33c4a --- /dev/null +++ b/apps/frontend/lib/api/endpoints/user.server.ts @@ -0,0 +1,6 @@ +import { User } from "@/lib/types/user"; +import { serverFetch } from "../server"; + +export async function me() { + return serverFetch('/api/user/me'); +} \ No newline at end of file diff --git a/apps/frontend/lib/api/server.ts b/apps/frontend/lib/api/server.ts index 31536f8..12912c7 100644 --- a/apps/frontend/lib/api/server.ts +++ b/apps/frontend/lib/api/server.ts @@ -56,4 +56,5 @@ export async function serverFetch( export * as BlogAPI from './endpoints/blog.server'; -export * as ResourceAPI from './endpoints/resource.server'; \ No newline at end of file +export * as ResourceAPI from './endpoints/resource.server'; +export * as UserAPI from './endpoints/user.server'; \ No newline at end of file