mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
@@ -12,7 +12,7 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
|
||||
onDestroy(() => {
|
||||
domain.set({ id: '', name: '' });
|
||||
domain.set({ $id: '', domain: '' });
|
||||
});
|
||||
|
||||
beforeNavigate(() => {
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
} from '$lib/elements/table';
|
||||
import { domain } from './store';
|
||||
|
||||
const parts = $domain.name.split('.');
|
||||
const parts = $domain.domain.split('.');
|
||||
const registerable = [parts[parts.length - 2], parts[parts.length - 1]].join('.');
|
||||
const cnameValue = $domain.name.replace('.' + registerable, '');
|
||||
const cnameValue = $domain.domain.replace('.' + registerable, '');
|
||||
</script>
|
||||
|
||||
<Table noStyles noMargin>
|
||||
@@ -28,8 +28,8 @@
|
||||
<TableCellText title="Name">{cnameValue}</TableCellText>
|
||||
<TableCell title="Value">
|
||||
<div class="u-flex u-main-space-between u-cross-center">
|
||||
<span class="text">{$domain.name}</span>
|
||||
<Copy value={$domain.name}>
|
||||
<span class="text">{$domain.domain}</span>
|
||||
<Copy value={$domain.domain}>
|
||||
<span class="icon-duplicate" aria-hidden="true" />
|
||||
</Copy>
|
||||
</div>
|
||||
|
||||
@@ -5,30 +5,14 @@
|
||||
import { project } from '../../../store';
|
||||
import { domain } from './store';
|
||||
|
||||
// Handle if user goes back to this step to update
|
||||
// the domain name after creating the domain
|
||||
const originalDomainName = $domain.name;
|
||||
const originalDomainId = $domain.id;
|
||||
const unsubscribe = domain.subscribe((newDomain) => {
|
||||
if (
|
||||
originalDomainName !== '' &&
|
||||
newDomain.id !== '' &&
|
||||
newDomain.name !== originalDomainName
|
||||
) {
|
||||
$domain.id = '';
|
||||
}
|
||||
});
|
||||
|
||||
const projectId = $project.$id;
|
||||
const createDomain = async () => {
|
||||
unsubscribe();
|
||||
if ($domain.name !== originalDomainName && originalDomainId) {
|
||||
await sdkForConsole.projects.deleteDomain(projectId, originalDomainId);
|
||||
if ($domain.$id) {
|
||||
await sdkForConsole.projects.deleteDomain(projectId, $domain.$id);
|
||||
}
|
||||
|
||||
if ($domain.id == '') {
|
||||
await sdkForConsole.projects.createDomain(projectId, $domain.name);
|
||||
}
|
||||
const { $id } = await sdkForConsole.projects.createDomain(projectId, $domain.domain);
|
||||
$domain.$id = $id;
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -45,7 +29,7 @@
|
||||
placeholder="appwrite.example.com"
|
||||
autocomplete={false}
|
||||
required
|
||||
bind:value={$domain.name} />
|
||||
bind:value={$domain.domain} />
|
||||
</FormList>
|
||||
<div class="common-section ">
|
||||
<p>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
let certificate = false;
|
||||
const checkCertificate = () => {
|
||||
setTimeout(async () => {
|
||||
const result = await sdkForConsole.projects.getDomain(projectId, $domain.id);
|
||||
const result = await sdkForConsole.projects.getDomain(projectId, $domain.$id);
|
||||
if (!result.certificateId) {
|
||||
checkCertificate();
|
||||
return;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export const domain = writable<{ id: string; name: string }>({ id: '', name: '' });
|
||||
export const domain = writable<Partial<Models.Domain>>({ $id: '', domain: '' });
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
try {
|
||||
const result = await sdkForConsole.projects.updateDomainVerification(
|
||||
projectId,
|
||||
$domain.id
|
||||
$domain.$id
|
||||
);
|
||||
isVerified = result.verification;
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user