feat: 实现前端资源管理

This commit is contained in:
2025-12-19 19:04:12 +08:00
parent 586a2976d2
commit ef2fa6fe5c
7 changed files with 25 additions and 27 deletions

View File

@@ -1,19 +1,6 @@
import { PublicResource } from "@/lib/types/resource";
import { serverFetch } from "../server";
export type ResourceTagType = {
name: string;
type: string;
}
export interface Resource {
id: string;
title: string;
description: string;
imageUrl: string;
link: string;
tags: ResourceTagType[];
}
export async function list() {
return serverFetch<Resource[]>('/api/resource')
return serverFetch<PublicResource[]>('/api/resource')
}

View File

@@ -3,6 +3,15 @@ export type TagType = {
type: string;
}
export interface PublicResource {
id: string;
title: string;
description: string;
imageUrl: string;
link: string;
tags: TagType[];
}
export interface Resource {
id: string;
title: string;
@@ -10,4 +19,6 @@ export interface Resource {
imageUrl: string;
link: string;
tags: TagType[];
createdAt: Date;
updatedAt: Date;
}