fix: Demo instance save domain instantly

This commit is contained in:
Andras Bacsai 2022-05-19 14:36:49 +02:00
parent 6a59b8d27c
commit e2bf02841f

View File

@ -88,9 +88,7 @@
function containerClass() { function containerClass() {
return 'text-white border border-dashed border-coolgray-300 bg-transparent font-thin px-0'; return 'text-white border border-dashed border-coolgray-300 bg-transparent font-thin px-0';
} }
if (browser && window.location.hostname === 'demo.coolify.io' && !application.fqdn) {
application.fqdn = `http://${cuid()}.demo.coolify.io`;
}
async function getUsage() { async function getUsage() {
if (usageLoading) return; if (usageLoading) return;
usageLoading = true; usageLoading = true;
@ -102,6 +100,10 @@
clearInterval(usageInterval); clearInterval(usageInterval);
}); });
onMount(async () => { onMount(async () => {
if (browser && window.location.hostname === 'demo.coolify.io' && !application.fqdn) {
application.fqdn = `http://${cuid()}.demo.coolify.io`;
await handleSubmit();
}
domainEl.focus(); domainEl.focus();
await getUsage(); await getUsage();
usageInterval = setInterval(async () => { usageInterval = setInterval(async () => {
@ -149,6 +151,7 @@
} }
} }
async function handleSubmit() { async function handleSubmit() {
if (loading) return;
loading = true; loading = true;
try { try {
nonWWWDomain = application.fqdn && getDomain(application.fqdn).replace(/^www\./, ''); nonWWWDomain = application.fqdn && getDomain(application.fqdn).replace(/^www\./, '');