Add activateCommunityRewards helper
cgen-9dd3fa64f7474dfa8eb219d693bcdfe5
This commit is contained in:
parent
409a321271
commit
c9631f5db1
1 changed files with 27 additions and 0 deletions
|
|
@ -718,6 +718,33 @@ export const aethexAchievementService = {
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
async activateCommunityRewards(target?: {
|
||||
email?: string;
|
||||
username?: string;
|
||||
}): Promise<ActivateRewardsResponse | null> {
|
||||
try {
|
||||
const payload = {
|
||||
targetEmail: target?.email,
|
||||
targetUsername: target?.username,
|
||||
};
|
||||
const response = await fetch("/api/achievements/activate", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
throw new Error(errorText || "Failed to activate community rewards");
|
||||
}
|
||||
|
||||
return (await response.json()) as ActivateRewardsResponse;
|
||||
} catch (error) {
|
||||
console.warn("activateCommunityRewards failed:", error);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
// Notification Service (uses existing notifications table)
|
||||
|
|
|
|||
Loading…
Reference in a new issue