mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 17:46:06 +00:00
refactor: Refine type definitions
- Enhance type safety for dashboard projects - Generalize `withCacheControl` to accept any `Response`
This commit is contained in:
@@ -78,7 +78,7 @@ export default async function DashboardPage() {
|
|||||||
}
|
}
|
||||||
const workspaces = Array.from(workspaceMap, ([id, name]) => ({ id, name }));
|
const workspaces = Array.from(workspaceMap, ([id, name]) => ({ id, name }));
|
||||||
|
|
||||||
const serializedProjects = projects.map((p) => ({
|
const serializedProjects = projects.map((p: typeof projects[0]) => ({
|
||||||
id: p.id,
|
id: p.id,
|
||||||
name: p.name,
|
name: p.name,
|
||||||
description: p.description,
|
description: p.description,
|
||||||
|
|||||||
+1
-1
@@ -126,7 +126,7 @@ export function successResponse<T>(
|
|||||||
return NextResponse.json(body, { status });
|
return NextResponse.json(body, { status });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function withCacheControl<T>(response: NextResponse<T>, value: string): NextResponse<T> {
|
export function withCacheControl<T>(response: Response, value: string): Response {
|
||||||
response.headers.set('Cache-Control', value);
|
response.headers.set('Cache-Control', value);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user