Skip to content

Commit

Permalink
Merge pull request #42 from compose-us/fix/host-createClientUrl-function
Browse files Browse the repository at this point in the history
Fix: make the original demo use the correct client
  • Loading branch information
nidhal-labidi authored Aug 27, 2024
2 parents fdcad87 + 9007a5b commit 5b86e57
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
5 changes: 2 additions & 3 deletions flottform/demo/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import { env } from '$env/dynamic/public';
export const sdpExchangeServerBase =
env.PUBLIC_FLOTTFORM_SERVER_BASE || 'https://192.168.0.21:5177/flottform';

const clientBase =
env.PUBLIC_FLOTTFORM_CLIENT_BASE || 'https://192.168.0.21:5173/multiple-input-form-client';
const clientBase = env.PUBLIC_FLOTTFORM_CLIENT_BASE || 'https://192.168.0.21:5173/flottform-client';

export const createClientUrl = async ({ endpointId }: { endpointId: string }) => {
if (browser) {
return `${window.location.origin}${base}/multiple-input-form-client/${endpointId}`;
return `${window.location.origin}${base}/flottform-client/${endpointId}`;
}
return `${clientBase}/${endpointId}`;
};
15 changes: 14 additions & 1 deletion flottform/demo/src/routes/multiple-input-form/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
<script lang="ts">
import { FlottformFileInputHost, defaultThemeForFileInput } from '@flottform/forms';
import { onMount } from 'svelte';
import { createClientUrl, sdpExchangeServerBase } from '../../api';
import { browser } from '$app/environment';
import { env } from '$env/dynamic/public';
import { base } from '$app/paths';
import { sdpExchangeServerBase } from '../../api';
const clientBase =
env.PUBLIC_FLOTTFORM_CLIENT_BASE || 'https://192.168.0.21:5177/multiple-input-form-client';
export const createClientUrl = async ({ endpointId }: { endpointId: string }) => {
if (browser) {
return `${window.location.origin}${base}/multiple-input-form-client/${endpointId}`;
}
return `${clientBase}/${endpointId}`;
};
onMount(async () => {
const fileInputs = document.querySelectorAll(
Expand Down

0 comments on commit 5b86e57

Please sign in to comment.