subs and fixes hack game

This commit is contained in:
2026-04-23 15:35:12 +07:00
parent 8c33f5c097
commit 40f7de803b
7 changed files with 387 additions and 111 deletions
+24
View File
@@ -34,3 +34,27 @@ export const submitHackResult = async (score: number) => {
if (!res.ok) throw new Error("Failed to sync breach data");
return res.json();
};
export const activateTrial = async () => {
const token = localStorage.getItem(TOKEN_KEY);
const res = await fetch(`${API_BASE}/trial`, {
method: "POST",
headers: { Authorization: `Bearer ${token}` },
});
if (!res.ok) throw new Error(await res.text());
return res.json();
};
export const buySubscription = async (plan: string) => {
const token = localStorage.getItem(TOKEN_KEY);
const res = await fetch(`${API_BASE}/subscribe`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({ plan }),
});
if (!res.ok) throw new Error(await res.text());
return res.json();
};