Skip to content

Commit bc91b93

Browse files
committed
Fix root certificate
1 parent 399000a commit bc91b93

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

apps/builder/app/builder/features/topbar/add-domain.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,6 @@ export const AddDomain = ({
7171
return;
7272
}
7373

74-
if (cname === "www") {
75-
const result = await nativeClient.domain.create.mutate({
76-
domain: domain.slice("www.".length),
77-
projectId,
78-
});
79-
if (result.success === false) {
80-
toast.error(result.error);
81-
setError(result.error);
82-
return;
83-
}
84-
}
85-
8674
onCreate(domain);
8775

8876
await refresh();

packages/domain/src/db/domain.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,21 @@ export const verify = async (
155155
domain,
156156
txtRecord: projectDomain.data.txtRecord,
157157
});
158-
159158
if (createDomainResult.success === false) {
160159
return createDomainResult;
161160
}
162161

162+
// create root certificate along with www
163+
if (domain.startsWith("www.")) {
164+
const createDomainResult = await context.domain.domainTrpc.create.mutate({
165+
domain: domain.slice("www.".length),
166+
txtRecord: projectDomain.data.txtRecord,
167+
});
168+
if (createDomainResult.success === false) {
169+
return createDomainResult;
170+
}
171+
}
172+
163173
const domainUpdateResult = await context.postgrest.client
164174
.from("Domain")
165175
.update({

0 commit comments

Comments
 (0)