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:
parent
bf569360cf
commit
24535e4e26
1 changed files with 2 additions and 2 deletions
|
|
@ -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: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue