subs and fixes hack game
This commit is contained in:
@@ -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();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user