Allow setting API endpoint via env variable

This commit is contained in:
2022-05-20 00:05:57 +02:00
parent 0eea73b780
commit f356fb9725

View File

@ -64,7 +64,7 @@ export const parsedTimetable = computed(() => {
}); });
export async function fetchData() { export async function fetchData() {
const baseUrl = "/api"; const baseUrl = import.meta.env.VITE_API_ENDPOINT || "/api";
const checkResponse = await fetch(`${baseUrl}/check`); const checkResponse = await fetch(`${baseUrl}/check`);
if (checkResponse.status != 200) router.push("/login"); if (checkResponse.status != 200) router.push("/login");