docs: update README and improve zap handling in webhooks and services
- Added a production checklist for Zaps (Lightning) in README.md, detailing necessary steps for historic zap visibility. - Enhanced comments in webhooks.service.ts to clarify zap handling and webhook requirements for BTCPay Server. - Improved logging in zaps.service.ts to provide more detailed information on zap payouts and recorded stats. - Updated error handling in zaps.service.ts to ensure robust logging if zap stats recording fails. - Refined getZapStats method in indeehub-api.service.ts to clarify mock data usage in development. These changes improve documentation and enhance the handling of zap-related functionalities across the application.
This commit is contained in:
@@ -206,8 +206,7 @@ class IndeehubApiService {
|
||||
|
||||
/**
|
||||
* Get zap stats for film cards (count, amount, recent zapper pubkeys) by project id.
|
||||
* In dev, or when API returns empty (e.g. no zaps in DB yet), merges mock data so the zap UI is visible.
|
||||
* Set VITE_HIDE_MOCK_ZAPS=true to never show mock zaps in production.
|
||||
* Mock data only in dev so the UI can be tested; production shows only real backend data.
|
||||
*/
|
||||
async getZapStats(projectIds: string[]): Promise<Record<string, { zapCount: number; zapAmountSats: number; recentZapperPubkeys: string[] }>> {
|
||||
if (projectIds.length === 0) return {}
|
||||
@@ -219,12 +218,13 @@ class IndeehubApiService {
|
||||
{ params: { projectIds: ids } },
|
||||
)
|
||||
data = response.data ?? {}
|
||||
} catch {
|
||||
} catch (err) {
|
||||
if (import.meta.env.DEV) {
|
||||
console.warn('[getZapStats] API failed, using empty stats:', err)
|
||||
}
|
||||
data = {}
|
||||
}
|
||||
const hideMock = import.meta.env.VITE_HIDE_MOCK_ZAPS === 'true'
|
||||
const shouldMock = !hideMock && (import.meta.env.DEV || Object.keys(data).length === 0)
|
||||
if (shouldMock) {
|
||||
if (import.meta.env.DEV) {
|
||||
Object.assign(data, this.getMockZapStats(projectIds))
|
||||
}
|
||||
return data
|
||||
|
||||
Reference in New Issue
Block a user