Enhance payment processing and rental features
- Updated the BTCPay service to support internal Lightning invoices with private route hints, improving payment routing for users with private channels. - Added reconciliation methods for pending rents and subscriptions to ensure missed payments are processed on startup. - Enhanced the rental and subscription services to handle payments in satoshis, aligning with Lightning Network standards. - Improved the rental modal and content detail components to display rental status and pricing more clearly, including a countdown for rental expiration. - Refactored various components to streamline user experience and ensure accurate rental access checks.
This commit is contained in:
@@ -22,16 +22,22 @@ class IndeehubApiService {
|
||||
},
|
||||
})
|
||||
|
||||
// Attach JWT token from NIP-98 session
|
||||
this.client.interceptors.request.use((config) => {
|
||||
const token = nip98Service.accessToken
|
||||
// Attach JWT token from NIP-98 session.
|
||||
// If the token has expired but we have a refresh token, proactively
|
||||
// refresh before sending the request to avoid unnecessary 401 round-trips.
|
||||
this.client.interceptors.request.use(async (config) => {
|
||||
let token = nip98Service.accessToken
|
||||
if (!token && sessionStorage.getItem('indeehub_api_refresh')) {
|
||||
token = await nip98Service.refresh()
|
||||
}
|
||||
if (token) {
|
||||
config.headers.Authorization = `Bearer ${token}`
|
||||
}
|
||||
return config
|
||||
})
|
||||
|
||||
// Auto-refresh on 401
|
||||
// Auto-refresh on 401 (fallback if the proactive refresh above
|
||||
// didn't happen or the token expired mid-flight)
|
||||
this.client.interceptors.response.use(
|
||||
(response) => response,
|
||||
async (error) => {
|
||||
|
||||
Reference in New Issue
Block a user