Skip to content

Commit a380d45

Browse files
committed
feat: add mock auth token setup in localStorage for development environments
1 parent 43bb7b7 commit a380d45

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

frontend/src/pages/SettingsPage.jsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,16 @@ const SettingsPage = () => {
6969
// --- Theme Management ---
7070
const { theme, setTheme, themeSaving } = useTheme();
7171
const { user } = useAuth();
72-
72+
// Ensure a mock token exists in localStorage for mock auth environments (non-destructive)
73+
useEffect(() => {
74+
try {
75+
const existing = localStorage.getItem('authToken');
76+
if (!existing) {
77+
localStorage.setItem('authToken', 'mock-jwt-token-12345');
78+
}
79+
} catch { /* ignore storage errors */ }
80+
}, []);
81+
7382
// --- State Management for Settings ---
7483
const [profile, setProfile] = useState({ displayName: '', email: '', department: '', badge: '' });
7584
const [apiKey, setApiKey] = useState('');
@@ -116,7 +125,7 @@ const SettingsPage = () => {
116125
}
117126
}, []);
118127

119-
useEffect(() => { if (user) fetchSettings(); }, [user, fetchSettings]);
128+
useEffect(() => { fetchSettings(); }, [user, fetchSettings]);
120129

121130
const handleSaveProfile = async () => {
122131
try {

0 commit comments

Comments
 (0)