chore: build backend frontend web
This commit is contained in:
@@ -92,9 +92,6 @@ export const extractUsernameFromToken = (): string | null => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* ✅ Synchroniser sessionStorage avec JWT
|
||||
*/
|
||||
export const syncUsernameFromJWT = (): string | null => {
|
||||
const jwtUsername = extractUsernameFromToken();
|
||||
|
||||
@@ -2198,12 +2195,14 @@ export const getMyPointsRewards = async (): Promise<{
|
||||
reward: PointsRewardConfig | null;
|
||||
}> => {
|
||||
const token = getAuthToken();
|
||||
if (!token) return { success: false, enabled: false, pools: [], reward: null };
|
||||
if (!token)
|
||||
return { success: false, enabled: false, pools: [], reward: null };
|
||||
try {
|
||||
const response = await fetch(`${API_URL}/points/rewards`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (!response.ok) return { success: false, enabled: false, pools: [], reward: null };
|
||||
if (!response.ok)
|
||||
return { success: false, enabled: false, pools: [], reward: null };
|
||||
const data = await safeJson(response);
|
||||
return {
|
||||
success: true,
|
||||
@@ -2259,7 +2258,9 @@ export const getOrderRatingStatus = async (
|
||||
}
|
||||
};
|
||||
|
||||
export const claimMyReward = async (poolKey: string): Promise<{
|
||||
export const claimMyReward = async (
|
||||
poolKey: string,
|
||||
): Promise<{
|
||||
success: boolean;
|
||||
description?: string;
|
||||
remaining_rewards?: number;
|
||||
@@ -2279,7 +2280,8 @@ export const claimMyReward = async (poolKey: string): Promise<{
|
||||
body: JSON.stringify({ pool_key: poolKey }),
|
||||
});
|
||||
const data = await safeJson(response);
|
||||
if (!response.ok) return { success: false, error: data.error || "Erreur" };
|
||||
if (!response.ok)
|
||||
return { success: false, error: data.error || "Erreur" };
|
||||
return {
|
||||
success: true,
|
||||
description: data.description,
|
||||
|
||||
Reference in New Issue
Block a user