🔧 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;
|
const showInLeaderboard = document.getElementById('showInLeaderboard').checked;
|
||||||
|
|
||||||
// Update player settings
|
// Update player settings using public endpoint (no API key needed)
|
||||||
const response = await fetch(`/api/v1/private/update-player-settings`, {
|
const response = await fetch(`/api/v1/public/update-player-settings`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json'
|
||||||
'Authorization': `Bearer ${localStorage.getItem('apiKey')}`
|
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
player_id: currentPlayerId,
|
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