Skip to content

Commit

Permalink
chore: fix build?
Browse files Browse the repository at this point in the history
  • Loading branch information
ArmanNik committed Feb 27, 2025
1 parent ae6993e commit f098718
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 30 deletions.
8 changes: 4 additions & 4 deletions src/lib/pages/domains/delete.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
let error: string;
function getCorrectMessage(): string {
const resourceType = selectedDomain.resourceType;
const resourceType = selectedDomain.type;
switch (resourceType) {
case 'api':
return `access ${resourceType}`;
case 'function':
return `execute your ${resourceType}`;
case 'site':
case 'deployment':
return `view your ${resourceType}`;
case 'redirect':
return `view your ${resourceType} `;
}
}
Expand Down
10 changes: 4 additions & 6 deletions src/lib/pages/domains/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import { Empty, Modal, SearchQuery } from '$lib/components';
import { Button } from '$lib/elements/forms';
import { onMount } from 'svelte';
import { dependencyStore, domain, typeStore } from './wizard/store';
import { dependencyStore } from './wizard/store';
import { toLocaleDate } from '$lib/helpers/date';
import { wizard } from '$lib/stores/wizard';
import type { Dependencies } from '$lib/constants';
import type { Models, ResourceType } from '@appwrite.io/console';
import type { Models } from '@appwrite.io/console';
import Create from './create.svelte';
import Delete from './delete.svelte';
import Retry from './wizard/retry.svelte';
Expand All @@ -31,9 +31,8 @@
import { page } from '$app/stores';
import { base } from '$app/paths';
export let search: string;
export let search: string = null;
export let rules: Models.ProxyRuleList;
export let type: ResourceType;
export let dependency: Dependencies;
let showDelete = false;
Expand All @@ -42,7 +41,6 @@
let retryError = null;
onMount(() => {
typeStore.set(type);
dependencyStore.set(dependency);
});
Expand Down Expand Up @@ -83,7 +81,7 @@
<Table.Header.Cell width="20px" />
{/if}
</svelte:fragment>
{#each rules.rules as domain, index}
{#each rules.rules as domain}
<Table.Row>
<Table.Cell>
<Layout.Stack direction="row" alignItems="center">
Expand Down
9 changes: 2 additions & 7 deletions src/lib/pages/domains/wizard/step1.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
import { sdk } from '$lib/stores/sdk';
import { isSelfHosted } from '$lib/system';
import { func } from '$routes/(console)/project-[project]/functions/function-[function]/store';
import { domain, typeStore } from './store';
import { domain } from './store';
import { consoleVariables } from '$routes/(console)/store';
import { ResourceType } from '@appwrite.io/console';
let error = null;
const isDomainsEnabled = $consoleVariables?._APP_DOMAIN_ENABLED === true;
Expand All @@ -20,11 +19,7 @@
}
// TODO: move to new api methods
$domain = await sdk.forProject.proxy.createRule(
$domain.domain,
$typeStore,
$typeStore === ResourceType.Function ? $func.$id : undefined
);
$domain = await sdk.forProject.proxy.createFunctionRule($domain.domain, $func.$id);
trackEvent(Submit.DomainCreate);
} catch (e) {
Expand Down
3 changes: 1 addition & 2 deletions src/lib/pages/domains/wizard/store.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Models, ResourceType } from '@appwrite.io/console';
import type { Models } from '@appwrite.io/console';
import { writable } from 'svelte/store';
import type { Dependencies } from '$lib/constants';

export const domain = writable<Partial<Models.ProxyRule>>({ $id: '', domain: '' });
export const typeStore = writable<ResourceType>();
export const dependencyStore = writable<Dependencies>();
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
import type { PageData } from './$types';
import { ProxyRulesPage } from '$lib/pages/domains';
import { Dependencies } from '$lib/constants';
import { ResourceType } from '@appwrite.io/console';
export let data: PageData;
</script>

<Container>
<ProxyRulesPage
rules={data.rules}
type={ResourceType.Function}
dependency={Dependencies.FUNCTION_DOMAINS}>
<ProxyRulesPage rules={data.rules} dependency={Dependencies.FUNCTION_DOMAINS}>
<svelte:fragment slot="heading">Domains</svelte:fragment>
</ProxyRulesPage>
</Container>
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@
import type { PageData } from './$types';
import { ProxyRulesPage } from '$lib/pages/domains';
import { Dependencies } from '$lib/constants';
import { ResourceType } from '@appwrite.io/console';
export let data: PageData;
</script>

<Container>
<ProxyRulesPage
search={data.search}
rules={data.rules}
type={ResourceType.Api}
dependency={Dependencies.DOMAINS}>
<ProxyRulesPage search={data.search} rules={data.rules} dependency={Dependencies.DOMAINS}>
<svelte:fragment slot="heading">Custom domains</svelte:fragment>
</ProxyRulesPage>
</Container>

0 comments on commit f098718

Please sign in to comment.