Skip to content

Commit 9b613f5

Browse files
author
Lasim
committed
fix: update storage key handling in DatabaseService to use dynamic baseUrl
1 parent 538d5fc commit 9b613f5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

services/frontend/src/services/database.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { getEnv } from '@/utils/env';
22
import type { DbStatusResponse, DbSetupRequest, DbSetupResponse } from '@/types/database';
33

4-
const STORAGE_KEY = 'deploystack_db_setup_status';
5-
64
class 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

Comments
 (0)