Skip to content

Commit c593500

Browse files
committed
feat: fill variables values
1 parent b5ca750 commit c593500

File tree

1 file changed

+15
-1
lines changed
  • src/routes/(console)/project-[project]/sites/create-site/templates/template-[template]

1 file changed

+15
-1
lines changed

src/routes/(console)/project-[project]/sites/create-site/templates/template-[template]/configuration.svelte

+15-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
import type { Models } from '@appwrite.io/console';
1212
import { Fieldset, Layout, Popover, Icon, Accordion } from '@appwrite.io/pink-svelte';
1313
import { IconInfo } from '@appwrite.io/pink-icons-svelte';
14-
import { type SvelteComponent } from 'svelte';
14+
import { onMount, type SvelteComponent } from 'svelte';
15+
import { getApiEndpoint } from '$lib/stores/sdk';
16+
import { page } from '$app/stores';
17+
import { project } from '$routes/(console)/project-[project]/store';
1518
1619
export let variables: Partial<Models.TemplateVariable>[] = [];
1720
export let templateVariables: Models.TemplateVariable[] = [];
@@ -29,6 +32,17 @@
2932
{ requiredVariables: [], optionalVariables: [] }
3033
);
3134
35+
variables.map((variable) => {
36+
if (variable.value === '{apiEndpoint}') {
37+
variable.value = getApiEndpoint();
38+
} else if (variable.value === '{projectId}') {
39+
variable.value = $page.params.project;
40+
} else if (variable.value === '{projectName}') {
41+
variable.value = $project.name;
42+
} else return variable;
43+
});
44+
variables = [...variables];
45+
3246
function selectComponent(variableType: string): typeof SvelteComponent<unknown> {
3347
switch (variableType) {
3448
case 'password':

0 commit comments

Comments
 (0)