completionId: cgen-7cbdac9a4b28403a879da8baf9b83af6
cgen-7cbdac9a4b28403a879da8baf9b83af6
This commit is contained in:
parent
9e63a9dc87
commit
245d4f54ea
1 changed files with 13 additions and 10 deletions
|
|
@ -894,7 +894,7 @@ export const aethexAchievementService = {
|
||||||
await aethexNotificationService.createNotification(
|
await aethexNotificationService.createNotification(
|
||||||
userId,
|
userId,
|
||||||
"success",
|
"success",
|
||||||
`🏆 Achievement Unlocked: ${achievement.name}`,
|
`<EFBFBD><EFBFBD> Achievement Unlocked: ${achievement.name}`,
|
||||||
`You've earned ${achievement.xp_reward} XP!`,
|
`You've earned ${achievement.xp_reward} XP!`,
|
||||||
);
|
);
|
||||||
} catch (notifError) {
|
} catch (notifError) {
|
||||||
|
|
@ -1031,20 +1031,23 @@ export const aethexAchievementService = {
|
||||||
username?: string;
|
username?: string;
|
||||||
}): Promise<ActivateRewardsResponse | null> {
|
}): Promise<ActivateRewardsResponse | null> {
|
||||||
try {
|
try {
|
||||||
// Skip if API_BASE is not configured (development edge case)
|
|
||||||
if (!API_BASE) {
|
|
||||||
console.warn(
|
|
||||||
"[Rewards] Skipping activation - API_BASE not configured",
|
|
||||||
);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
targetEmail: target?.email,
|
targetEmail: target?.email,
|
||||||
targetUsername: target?.username,
|
targetUsername: target?.username,
|
||||||
};
|
};
|
||||||
|
|
||||||
const url = `${API_BASE}/api/achievements/activate`;
|
// Use API_BASE or fallback to window.location.origin for local dev
|
||||||
|
const baseUrl =
|
||||||
|
API_BASE || (typeof window !== "undefined" ? window.location.origin : "");
|
||||||
|
|
||||||
|
if (!baseUrl) {
|
||||||
|
console.warn(
|
||||||
|
"[Rewards] Cannot activate - no API base URL available",
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = `${baseUrl}/api/achievements/activate`;
|
||||||
console.log("[Rewards] Activating at:", url);
|
console.log("[Rewards] Activating at:", url);
|
||||||
|
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue