feat: 重构前端api封装结构
This commit is contained in:
19
apps/frontend/lib/api/endpoints/resource.server.ts
Normal file
19
apps/frontend/lib/api/endpoints/resource.server.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
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')
|
||||
}
|
||||
Reference in New Issue
Block a user