feat(site): /start creates an account, not an instance
The form posts to admin's signup and the slug preview goes: there is no instance at this point, and previewing one promises something the submission does not create. Creating the instance is now a step in the portal, which the page's What happens next panel spells out. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+16
-4
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
const SITE_API = (process.env.NEXT_PUBLIC_SITE_API ?? "").replace(/\/$/, "");
|
||||
const ADMIN_API = (process.env.NEXT_PUBLIC_ADMIN_API_URL ?? "").replace(/\/$/, "");
|
||||
const FALLBACK_ADDRESS = process.env.NEXT_PUBLIC_CONTACT_EMAIL ?? "support@hostxtra.co.uk";
|
||||
|
||||
export type SubmitState = "idle" | "sending" | "sent" | "error";
|
||||
@@ -56,12 +57,23 @@ export async function submitContact(fields: { name: string; email: string; serve
|
||||
return post(`${SITE_API}/api/contact`, fields);
|
||||
}
|
||||
|
||||
export async function submitSignup(fields: { instance_name: string; email: string; password: string; website: string }): Promise<SubmitResult> {
|
||||
if (!SITE_API) {
|
||||
/*
|
||||
* Account signup posts to the admin service, not sitesvc. The two form targets
|
||||
* are deliberately separate variables rather than one base URL: contact and
|
||||
* signup are owned by different services, and an implied shared host is how they
|
||||
* silently end up pointing at the wrong one.
|
||||
*/
|
||||
export async function submitAccountSignup(fields: {
|
||||
name: string;
|
||||
email: string;
|
||||
password: string;
|
||||
website: string;
|
||||
}): Promise<SubmitResult> {
|
||||
if (!ADMIN_API) {
|
||||
return {
|
||||
state: "error",
|
||||
message: `Signup is not available from here yet. Email ${FALLBACK_ADDRESS} and we will set you up.`,
|
||||
message: `Signup is not connected yet. Email ${FALLBACK_ADDRESS} and we will set you up.`,
|
||||
};
|
||||
}
|
||||
return post(`${SITE_API}/api/signup`, fields);
|
||||
return post(`${ADMIN_API}/auth/signup`, fields);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user