fix: 已有数据库再次安装时接上原库而不是报错

This commit is contained in:
2026-10-30 10:31:08 +08:00
parent ea3391af76
commit 613ed3a8c7
5 changed files with 47 additions and 21 deletions
+2 -2
View File
@@ -40,7 +40,7 @@ async function submit() {
busy.value = true;
errorText.value = "";
try {
await api("/api/install", {
const result = await api<{ already?: boolean }>("/api/install", {
method: "POST",
body: JSON.stringify({
host: host.value,
@@ -53,7 +53,7 @@ async function submit() {
}),
});
markInstalled();
router.push("/login");
router.push(result.already ? { path: "/login", query: { notice: "already" } } : "/login");
} catch (error) {
errorText.value = error instanceof Error ? error.message : "安装失败";
} finally {