docs: fixes and refactoring for API reference (#9708)

* docs: fixes and refactoring for API reference

* add route caching

* remove caching

* use next cache
This commit is contained in:
Shahed Nasser
2024-10-22 18:20:06 +03:00
committed by GitHub
parent 6b989353ac
commit b2122c4073
20 changed files with 377 additions and 277 deletions
+20
View File
@@ -0,0 +1,20 @@
"use server"
import { Area, ExpandedDocument } from "../types/openapi"
const URL = `${process.env.NEXT_PUBLIC_BASE_URL}${process.env.NEXT_PUBLIC_BASE_PATH}`
export async function getBaseSpecs(area: Area) {
try {
const res = await fetch(`${URL}/api/base-specs?area=${area}`, {
next: {
revalidate: 3000,
tags: [area],
},
}).then(async (res) => res.json())
return res as ExpandedDocument
} catch (e) {
console.error(e)
}
}