Import repositories from gitlab
This commit is contained in:
19
next/api/index.js
Normal file
19
next/api/index.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import qs from "qs";
|
||||
|
||||
async function getData(path, query) {
|
||||
const queryString = qs.stringify(query);
|
||||
const isServerSide = typeof window === "undefined";
|
||||
const res = await fetch(
|
||||
`${
|
||||
isServerSide
|
||||
? process.env.NEXT_PRIVATE_CONTENT_URI ??
|
||||
"http://fefan-backend:1337/api"
|
||||
: process.env.NEXT_PUBLIC_CONTENT_URI ?? "https://content.fefan.fr/api"
|
||||
}/${path}?${queryString}`,
|
||||
{ cache: "no-store" }
|
||||
);
|
||||
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
export default getData;
|
||||
Reference in New Issue
Block a user