MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / validateDomain

Function validateDomain

apps/web/ui/BrandingView/index.tsx:399–436  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

397 const [loading, setLoading] = useState(false);
398
399 const validateDomain = async () => {
400 const form = document.getElementById('branding-form') as HTMLFormElement;
401 if (!form) {
402 return;
403 }
404
405 try {
406 setLoading(true);
407 const domain = stripProtocol(form.redirectDomain.value).toLowerCase();
408
409 if (domain !== currentCommunity.redirectDomain) {
410 await api.updateAccount({
411 accountId: currentCommunity.id,
412 redirectDomain: domain,
413 });
414 dnsSettings(true);
415 currentCommunity.redirectDomain = domain;
416 }
417
418 const result = await api.validateDomain({
419 domain,
420 accountId: currentCommunity.id,
421 });
422
423 if (result.ok) {
424 setStatusColor('green');
425 setStatusText('Custom domain is working.');
426 } else {
427 setStatusColor('red');
428 setStatusText(result.cause || 'Invalid, try again later.');
429 }
430 } catch (error: any) {
431 setStatusColor('red');
432 setStatusText(error.details || 'Something went wrong.');
433 } finally {
434 setLoading(false);
435 }
436 };
437
438 return (
439 <div className={styles.domainValidationWrapper}>

Callers 1

DomainStatusFunction · 0.85

Calls 2

stripProtocolFunction · 0.90
dnsSettingsFunction · 0.85

Tested by

no test coverage detected