- Replace identity management with a new authentication system across the application. - Update App.vue to integrate LoginDialog and remove PasswordDialog. - Modify Navbar.vue to handle user authentication state and logout functionality. - Enhance Home.vue to display user information upon login. - Implement routing changes in index.ts to enforce authentication requirements for protected routes.
38 lines
No EOL
1.1 KiB
TypeScript
38 lines
No EOL
1.1 KiB
TypeScript
// LNBits API Configuration
|
|
export const LNBITS_CONFIG = {
|
|
// Base URL for the LNBits API
|
|
// This should point to your LNBits instance
|
|
API_BASE_URL: import.meta.env.VITE_LNBITS_API_URL || '/api/v1',
|
|
|
|
// Whether to enable debug logging
|
|
DEBUG: import.meta.env.VITE_LNBITS_DEBUG === 'true',
|
|
|
|
// Timeout for API requests (in milliseconds)
|
|
REQUEST_TIMEOUT: 10000,
|
|
|
|
// Auth token storage key
|
|
AUTH_TOKEN_KEY: 'lnbits_access_token',
|
|
|
|
// User storage key
|
|
USER_STORAGE_KEY: 'lnbits_user_data'
|
|
}
|
|
|
|
// Helper function to get the full API URL
|
|
export function getApiUrl(endpoint: string): string {
|
|
return `${LNBITS_CONFIG.API_BASE_URL}${endpoint}`
|
|
}
|
|
|
|
// Helper function to get auth token from storage
|
|
export function getAuthToken(): string | null {
|
|
return localStorage.getItem(LNBITS_CONFIG.AUTH_TOKEN_KEY)
|
|
}
|
|
|
|
// Helper function to set auth token in storage
|
|
export function setAuthToken(token: string): void {
|
|
localStorage.setItem(LNBITS_CONFIG.AUTH_TOKEN_KEY, token)
|
|
}
|
|
|
|
// Helper function to remove auth token from storage
|
|
export function removeAuthToken(): void {
|
|
localStorage.removeItem(LNBITS_CONFIG.AUTH_TOKEN_KEY)
|
|
}
|