feat(volume): serverseitig pro Guild persistieren (state.json), API GET/POST /api/volume; Frontend lädt gespeicherte Lautstärke
This commit is contained in:
parent
fee1feaca4
commit
beeffb7605
3 changed files with 71 additions and 5 deletions
|
|
@ -41,6 +41,15 @@ export async function setVolumeLive(guildId: string, volume: number): Promise<vo
|
|||
}
|
||||
}
|
||||
|
||||
export async function getVolume(guildId: string): Promise<number> {
|
||||
const url = new URL(`${API_BASE}/volume`, window.location.origin);
|
||||
url.searchParams.set('guildId', guildId);
|
||||
const res = await fetch(url.toString());
|
||||
if (!res.ok) throw new Error('Fehler beim Laden der Lautstärke');
|
||||
const data = await res.json();
|
||||
return typeof data?.volume === 'number' ? data.volume : 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue