refactor: Transition to authentication system and remove identity management
- 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.
This commit is contained in:
parent
5ceb12ca3b
commit
be4ab13b32
11 changed files with 1065 additions and 96 deletions
38
src/lib/config/lnbits.ts
Normal file
38
src/lib/config/lnbits.ts
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// 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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue