Signed-off-by: Max Schmidt <max.schmidt@outlook.de>
This commit is contained in:
Max Schmidt 2023-05-17 16:52:46 +02:00
parent 5ca25e699a
commit ec0e7601c4

View File

@ -1,9 +1,9 @@
import type { Post } from "../types"; import type { Post } from "../types";
const url = const url =
process.env.NODE_ENV === "development" import.meta.env.NODE_ENV === "development"
? "http://payload:3001" ? "http://payload:3001"
: `https://${process.env.PAYLOAD_URL}`; : `https://${import.meta.env.PAYLOAD_URL}`;
export const getPosts = async () => export const getPosts = async () =>
(await (await fetch(`${url}/api/posts`)).json()).docs as Post[]; (await (await fetch(`${url}/api/posts`)).json()).docs as Post[];