mirror of
https://github.com/ceratic/project_vollidioten_website.git
synced 2026-05-14 00:16:47 +02:00
Refactor CityProfile and PlayerProfile components for improved data fetching and error handling; add NPC management modals for banner, gallery, and logo with enhanced user experience and error feedback.
This commit is contained in:
@@ -78,6 +78,26 @@ class DatabaseService {
|
||||
return this.players.find(p => p.uuid === uuid);
|
||||
}
|
||||
|
||||
// Fetch individual player data directly from API (for profile pages)
|
||||
async fetchPlayer(uuid: string): Promise<Player | null> {
|
||||
try {
|
||||
const response = await fetch(`${API_URL}/players/${uuid}`);
|
||||
if (response.ok) {
|
||||
const playerData = await response.json();
|
||||
// Update local cache
|
||||
this.players = this.players.map(p => p.uuid === uuid ? playerData : p);
|
||||
if (!this.players.find(p => p.uuid === uuid)) {
|
||||
this.players.push(playerData);
|
||||
}
|
||||
this.notify();
|
||||
return playerData;
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("Failed to fetch individual player data", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
getOrg(id: string): Organization | undefined {
|
||||
return this.orgs.find(o => o.id === id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user