promo! react

This commit is contained in:
Zakhar
2026-08-28 09:41:34 +03:00
parent 8c5d86c9ab
commit 8526e66f5c
4 changed files with 142 additions and 21 deletions
+5 -4
View File
@@ -28,18 +28,19 @@ export async function loadInitialData(): Promise<InitialData> {
return retryResponse.json();
}
// Handle 403 or need_refresh cases
if (response.status === 403 || data.error_message === 'need_refresh') {
await refreshToken();
const retryResponse = await fetch(apiUrl('/api/promo/get_initial_data'), {
credentials: 'include',
});
return retryResponse.json();
}
// Success case
return data;
} catch {
} catch (error) {
console.error('Error in loadInitialData:', error);
return fallbackInitialData;
}
}
@@ -116,4 +117,4 @@ const fallbackInitialData: InitialData = {
days: 7,
excess: 0,
precision: 0,
}
};