Add visitor tracking and combat selection features

This commit is contained in:
2026-05-22 13:22:26 +09:00
parent 104bf4fe48
commit 1509b0c5dd
20 changed files with 1049 additions and 1220 deletions
+23
View File
@@ -0,0 +1,23 @@
export async function trackVisitor({ onUpdate, onError } = {}) {
try {
const response = await fetch("/api/visitors/check", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
body: "{}",
});
if (!response.ok) {
throw new Error(`Visitor check failed: ${response.status}`);
}
const visitorStats = await response.json();
onUpdate?.(visitorStats);
return visitorStats;
} catch (error) {
onError?.(error);
return null;
}
}