🔧 Fix settings API: Use public endpoint for logged-in users
- Changed from /api/v1/private/update-player-settings to /api/v1/public/update-player-settings - Removed API key requirement for logged-in users - Added both public and private endpoints for flexibility - Fixed 401 Unauthorized error in settings modal
This commit is contained in:
@@ -984,12 +984,11 @@ async function saveSettings() {
|
||||
|
||||
const showInLeaderboard = document.getElementById('showInLeaderboard').checked;
|
||||
|
||||
// Update player settings
|
||||
const response = await fetch(`/api/v1/private/update-player-settings`, {
|
||||
// Update player settings using public endpoint (no API key needed)
|
||||
const response = await fetch(`/api/v1/public/update-player-settings`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${localStorage.getItem('apiKey')}`
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
player_id: currentPlayerId,
|
||||
|
||||
1084
routes/api.js
1084
routes/api.js
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user