diff --git a/src/routes/console/project-[project]/functions/function-[function]/execute.svelte b/src/routes/console/project-[project]/functions/function-[function]/execute.svelte index 24f026f25..6f53461d6 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/execute.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/execute.svelte @@ -4,6 +4,8 @@ import { Code, Modal } from '$lib/components'; import { Button } from '$lib/elements/forms'; import { InputTextarea, FormList, InputChoice } from '$lib/elements/forms'; + import InputSelect from '$lib/elements/forms/inputSelect.svelte'; + import InputText from '$lib/elements/forms/inputText.svelte'; import { addNotification } from '$lib/stores/notifications'; import { sdkForProject } from '$lib/stores/sdk'; import type { Models } from '@aw-labs/appwrite-console'; @@ -11,27 +13,27 @@ export let selectedFunction: Models.Function = null; let show = false; - let data: string = null; - let showJson = false; + let body: string = null; + let path: string = null; + let method: string = null; + let headers: string = null; let submitting = false; - const example = `{ - firstName: "hello", - lastName:"world", - age:"old" -}`; - $: if (selectedFunction && !show) { show = true; } const handleSubmit = async () => { submitting = true; + try { await sdkForProject.functions.createExecution( selectedFunction.$id, - data?.length ? data : undefined, - true + body?.length ? body : undefined, + true, + path?.length ? path : undefined, + method?.length ? method : undefined, + headers?.length ? JSON.parse(headers) : undefined ); close(); addNotification({ @@ -60,12 +62,20 @@ Execute Function - - - Here's an example of some custom data. - {#if showJson} - - {/if} + + + +