game update test

This commit is contained in:
2026-04-23 15:13:29 +07:00
parent 5aecd41d4f
commit 8c33f5c097
4 changed files with 120 additions and 15 deletions
+19
View File
@@ -15,3 +15,22 @@ export const fetchProfile = async () => {
if (!res.ok) throw new Error("Failed to fetch profile");
return res.json();
};
// Существующий код...
export const submitHackResult = async (score: number) => {
const token = localStorage.getItem(TOKEN_KEY);
if (!token) throw new Error("No token found");
const res = await fetch(`${API_BASE}/hack/result`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({ score }),
});
if (!res.ok) throw new Error("Failed to sync breach data");
return res.json();
};