11import { getEnv } from '@/utils/env' ;
22import type { DbStatusResponse , DbSetupRequest , DbSetupResponse } from '@/types/database' ;
33
4- const STORAGE_KEY = 'deploystack_db_setup_status' ;
5-
64class DatabaseService {
75 private baseUrl : string ;
6+ private storageKey : string ;
87
98 constructor ( ) {
109 this . baseUrl = getEnv ( 'VITE_DEPLOYSTACK_APP_URL' ) || 'http://localhost:3000' ;
10+ this . storageKey = `deploystack_db_setup_status_${ this . baseUrl } ` ;
1111 }
1212
1313 /**
@@ -75,7 +75,7 @@ class DatabaseService {
7575 */
7676 getCachedSetupStatus ( ) : boolean | null {
7777 try {
78- const cached = localStorage . getItem ( STORAGE_KEY ) ;
78+ const cached = localStorage . getItem ( this . storageKey ) ;
7979 return cached ? JSON . parse ( cached ) : null ;
8080 } catch {
8181 return null ;
@@ -87,7 +87,7 @@ class DatabaseService {
8787 */
8888 private cacheSetupStatus ( isSetup : boolean ) : void {
8989 try {
90- localStorage . setItem ( STORAGE_KEY , JSON . stringify ( isSetup ) ) ;
90+ localStorage . setItem ( this . storageKey , JSON . stringify ( isSetup ) ) ;
9191 } catch ( error ) {
9292 console . warn ( 'Failed to cache setup status:' , error ) ;
9393 }
@@ -98,7 +98,7 @@ class DatabaseService {
9898 */
9999 clearCache ( ) : void {
100100 try {
101- localStorage . removeItem ( STORAGE_KEY ) ;
101+ localStorage . removeItem ( this . storageKey ) ;
102102 } catch ( error ) {
103103 console . warn ( 'Failed to clear setup status cache:' , error ) ;
104104 }
0 commit comments