Compare commits

..

2 Commits

Author SHA1 Message Date
MangoPig
35c1a861f5 Merge branch 'Features/Backend/Bootstrap-Reset' 2026-06-19 19:57:46 +01:00
MangoPig
27101bbdd6 Feat: Add development bootstrap reset 2026-06-19 19:57:44 +01:00

View File

@@ -45,7 +45,6 @@ const bootstrapStepDefinitions: readonly BootstrapStepDefinition[] = [
];
const bootstrapCompletionStorageKey = "moku.bootstrap.completed";
const isDevelopmentEnvironment = import.meta.env.DEV;
const defaultInstanceForm = {
protocol: "http",
@@ -58,7 +57,7 @@ const defaultModeForm = {
} as const;
const defaultAdminForm = {
displayName: "First admin",
displayName: "Admin",
email: "admin@example.com",
password: "",
} as const;
@@ -292,32 +291,6 @@ export const WorkspaceHome = (props: WorkspaceHomeProps): JSX.Element => {
void submitCurrentStep();
};
const handleDevelopmentReset = async (): Promise<void> => {
const response = await fetch(`${apiBase()}/dev/bootstrap/reset`, {
method: "POST",
headers: {
Accept: "application/json",
},
});
const data = await readResponseBody(response);
if (!response.ok) {
throw new Error(
typeof data?.message === "string"
? data.message
: typeof data?.error?.message === "string"
? data.error.message
: "Failed to reset development bootstrap state.",
);
}
writeBootstrapCompletion(false);
setIsBootstrapComplete(false);
setIsWizardOpen(true);
resetWizardState();
await appShellData.reload();
};
const statusLabel = (state: BootstrapSubmissionState): string => {
switch (state.status) {
case "submitting":
@@ -379,20 +352,6 @@ export const WorkspaceHome = (props: WorkspaceHomeProps): JSX.Element => {
</button>
</div>
</Show>
<Show when={isDevelopmentEnvironment && isBootstrapStateResolved()}>
<div class={styles.heroActions}>
<button
type="button"
class={styles.secondaryButton}
data-slot="development-bootstrap-reset"
onClick={() => {
void handleDevelopmentReset();
}}
>
Reset development bootstrap state
</button>
</div>
</Show>
</section>
</main>
@@ -496,13 +455,13 @@ export const WorkspaceHome = (props: WorkspaceHomeProps): JSX.Element => {
<>
<label class={styles.field}>
<span class={styles.fieldLabel}>Display name</span>
<input
type="text"
value={adminForm.displayName}
onInput={(event): void => setAdminForm("displayName", event.currentTarget.value)}
placeholder="First admin"
/>
</label>
<input
type="text"
value={adminForm.displayName}
onInput={(event): void => setAdminForm("displayName", event.currentTarget.value)}
placeholder="Admin"
/>
</label>
<label class={styles.field}>
<span class={styles.fieldLabel}>Email</span>
<input