Fix token retrieval in Settings page

🔧 Authentication Fix:
- Change localStorage.getItem('token') to localStorage.getItem('tcg_vault_token')
- Match the token key used in AuthContext ('tcg_vault_token')
- Fix both loadPreferences and savePreferences functions

This resolves the 'Invalid or expired token' error when accessing settings.
The token was being stored correctly but retrieved with wrong key.
This commit is contained in:
Randall Stillwell 2025-07-22 10:59:48 -05:00
parent bf569360cf
commit 24535e4e26

View file

@ -39,7 +39,7 @@ const Settings: React.FC = () => {
if (!user) return;
try {
const token = localStorage.getItem('token');
const token = localStorage.getItem('tcg_vault_token');
const response = await fetch('/api/user/preferences', {
headers: {
'Authorization': `Bearer ${token}`,
@ -66,7 +66,7 @@ const Settings: React.FC = () => {
setIsSaving(true);
try {
const token = localStorage.getItem('token');
const token = localStorage.getItem('tcg_vault_token');
const response = await fetch('/api/user/preferences', {
method: 'PUT',
headers: {