diff --git a/create_group.html b/create_group.html
index 4dfe50b..97986f4 100644
--- a/create_group.html
+++ b/create_group.html
@@ -11,7 +11,6 @@
-
新規グループ作成
@@ -19,8 +18,8 @@
-
+
@@ -34,37 +33,14 @@
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9ndGxtdG5qa3BzeHNxenFsYWNqIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjMyOTU3NjUsImV4cCI6MjA3ODg3MTc2NX0.JnCE7oUQwrSgGqiu-QRbwnaLBZrO8JX1_RUb37VIMFI"
);
-/* ----------------------------------------------------
- URLパラメータから group/pass を自動入力
----------------------------------------------------- */
-const params = new URLSearchParams(location.search);
-const autoGroup = params.get("group");
-const autoPass = params.get("pass");
-
-if (autoGroup) document.getElementById("group").value = autoGroup;
-if (autoPass) document.getElementById("pass").value = autoPass;
-
-
-/* ----------------------------------------------------
- ① 通常作成して参加 (従来の動作)
----------------------------------------------------- */
document.getElementById("createBtn").onclick = async () => {
- await createGroup(false); // リンク生成なし
+ await createGroup(false);
};
-
-/* ----------------------------------------------------
- ② 共有リンクを作成して参加
----------------------------------------------------- */
document.getElementById("inviteBtn").onclick = async () => {
- await createGroup(true); // リンク生成あり
+ await createGroup(true);
};
-
-/* ----------------------------------------------------
- 共通:グループ作成処理
- makeInvite = true のとき → 招待リンク作成
----------------------------------------------------- */
async function createGroup(makeInvite) {
const group = document.getElementById("group").value.trim();
const pass = document.getElementById("pass").value.trim();
@@ -76,7 +52,7 @@
return;
}
- // グループ名重複確認
+ // 既存確認
const { data: exists } = await supa
.from("groups")
.select("*")
@@ -88,31 +64,28 @@
return;
}
- // Supabase に新規作成
+ // 作成
await supa.from("groups").insert({
group_name: group,
password: pass,
host_name: user
});
- /* ----------------------------------------
- 招待リンクを作成してコピー
- ---------------------------------------- */
+ /* ------------- 共有リンクを作成する場合 ------------- */
if (makeInvite) {
- const base = location.origin + location.pathname;
- const inviteURL = `${base}?group=${encodeURIComponent(group)}&pass=${encodeURIComponent(pass)}`;
+ const inviteURL =
+ `https://www.yatex.org/gitbucket/KoekiGameDesign/2025-shino/pages/join.html`
+ + `?group=${encodeURIComponent(group)}&pass=${encodeURIComponent(pass)}`;
try {
await navigator.clipboard.writeText(inviteURL);
- alert("🎉 招待リンクをコピーしました!\n友達に送ってください。");
+ alert("🎉 招待リンクをコピーしました!\n友だちに送ってください。");
} catch {
alert("コピーに失敗しました…");
}
}
- /* ----------------------------------------
- 自分はそのままマップ画面へ
- ---------------------------------------- */
+ /* ------------ 自分はそのまま参加 ------------ */
location.href = `map4.html?group=${group}&user=${user}&host=1`;
}