Put API prefix in server only file to access process.env

This commit is contained in:
thiloho
2024-08-19 20:33:23 +02:00
parent 488877b2ed
commit 28774dc944
15 changed files with 29 additions and 25 deletions

View File

@@ -5,7 +5,6 @@
import SuccessOrError from "$lib/components/SuccessOrError.svelte";
import type { ActionData, PageServerData } from "./$types";
import Modal from "$lib/components/Modal.svelte";
import { API_BASE_PREFIX } from "$lib/utils";
const { data, form } = $props<{ data: PageServerData; form: ActionData }>();
@@ -19,7 +18,7 @@
};
const handlePaste = async (event: ClipboardEvent) => {
const newContent = await handleImagePaste(event);
const newContent = await handleImagePaste(event, data.API_BASE_PREFIX);
previewContent = newContent;
};
</script>
@@ -72,7 +71,7 @@
{#if data.globalSettings.favicon_image}
<Modal id="preview-favicon-global-{data.globalSettings.website_id}" text="Preview">
<img
src={`${API_BASE_PREFIX}/rpc/retrieve_file?id=${data.globalSettings.favicon_image}`}
src={`${data.API_BASE_PREFIX}/rpc/retrieve_file?id=${data.globalSettings.favicon_image}`}
alt=""
/>
</Modal>
@@ -125,7 +124,10 @@
</label>
{#if data.header.logo_image}
<Modal id="preview-logo-header-{data.header.website_id}" text="Preview">
<img src={`${API_BASE_PREFIX}/rpc/retrieve_file?id=${data.header.logo_image}`} alt="" />
<img
src={`${data.API_BASE_PREFIX}/rpc/retrieve_file?id=${data.header.logo_image}`}
alt=""
/>
</Modal>
{/if}
</div>