mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix: unable to add domain if apex already exists!
This commit is contained in:
1 parent
044312bf0d
commit
7f678cf9d0
3 files changed
+31
-20
No files matched your search
+10
-7
@@ -48,18 +48,21 @@
|
||||
|
||||
async function addDomain() {
|
||||
const apexDomain = getApexDomain(domainName);
|
||||
let domain = data.domains?.domains.find((d) => d.domain === apexDomain);
|
||||
let domain = data.domains?.domains.find((d: Models.Domain) => d.domain === apexDomain);
|
||||
|
||||
if (apexDomain && !domain && isCloud) {
|
||||
try {
|
||||
domain = await sdk.forConsole.domains.create($project.teamId, apexDomain);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
|
||||
return;
|
||||
// apex might already be added on organization level, skip.
|
||||
const alreadyAdded = error?.type === 'domain_already_exists';
|
||||
if (!alreadyAdded) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-7
@@ -12,6 +12,7 @@
|
||||
import { isCloud } from '$lib/system';
|
||||
import { project } from '$routes/(console)/project-[region]-[project]/store';
|
||||
import { getApexDomain } from '$lib/helpers/tlds';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
|
||||
const routeBase = `${base}/project-${page.params.region}-${page.params.project}/settings/domains`;
|
||||
|
||||
@@ -29,18 +30,21 @@
|
||||
|
||||
async function addDomain() {
|
||||
const apexDomain = getApexDomain(domainName);
|
||||
let domain = data.domains?.domains.find((d) => d.domain === apexDomain);
|
||||
let domain = data.domains?.domains.find((d: Models.Domain) => d.domain === apexDomain);
|
||||
|
||||
if (apexDomain && !domain && isCloud) {
|
||||
try {
|
||||
domain = await sdk.forConsole.domains.create($project.teamId, apexDomain);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
|
||||
return;
|
||||
// apex might already be added on organization level, skip.
|
||||
const alreadyAdded = error?.type === 'domain_already_exists';
|
||||
if (!alreadyAdded) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-6
@@ -53,17 +53,21 @@
|
||||
|
||||
async function addDomain() {
|
||||
const apexDomain = getApexDomain(domainName);
|
||||
let domain = data.domains?.domains.find((d) => d.domain === apexDomain);
|
||||
let domain = data.domains?.domains.find((d: Models.Domain) => d.domain === apexDomain);
|
||||
|
||||
if (apexDomain && !domain && isCloud) {
|
||||
try {
|
||||
domain = await sdk.forConsole.domains.create($project.teamId, apexDomain);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
return;
|
||||
// apex might already be added on organization level, skip.
|
||||
const alreadyAdded = error?.type === 'domain_already_exists';
|
||||
if (!alreadyAdded) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user