Signed-off-by: Max Schmidt <max.schmidt@outlook.de>
This commit is contained in:
Max Schmidt
2023-05-17 17:30:59 +02:00
parent 21fe6de0ec
commit 75e0a0192d
2 changed files with 4 additions and 5 deletions

View File

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