feat: 添加user/me封装

This commit is contained in:
2025-12-17 15:35:19 +08:00
parent 84a6e0876c
commit f69d79a0ff
4 changed files with 16 additions and 2 deletions

View File

@@ -46,3 +46,4 @@ export async function clientFetch<T = unknown>(
export * as AuthAPI from './endpoints/auth.client'
export * as UserAPI from './endpoints/user.client'

View File

@@ -0,0 +1,6 @@
import { User } from "@/lib/types/user";
import { clientFetch } from "../client";
export async function me() {
return clientFetch<User>('/api/user/me');
}

View File

@@ -0,0 +1,6 @@
import { User } from "@/lib/types/user";
import { serverFetch } from "../server";
export async function me() {
return serverFetch<User>('/api/user/me');
}

View File

@@ -57,3 +57,4 @@ export async function serverFetch<T = unknown>(
export * as BlogAPI from './endpoints/blog.server';
export * as ResourceAPI from './endpoints/resource.server';
export * as UserAPI from './endpoints/user.server';