Sektor-Onboarding & Charaktererstellung (Frontend)

This commit is contained in:
2026-06-07 00:53:55 +02:00
parent 18f99e896c
commit 99721bde8f
16 changed files with 858 additions and 148 deletions
+30
View File
@@ -30,3 +30,33 @@ export async function fetchSectorsList(token) {
throw error;
}
}
/**
* Sendet die Anfrage an das Backend, um einem neuen Sektor beizutreten.
*
* @param {string} token - Das JWT Access Token
* @param {string} sectorId - Die UUID des Sektors
* @param {string} localUsername - Der gewünschte Commander-Name
* @param {string} gender - Das gewählte Geschlecht ('male' oder 'female')
*
* @returns {Promise<Object>} - Ein Objekt mit 'ok' (boolean) und den 'data' (JSON)
*/
export async function joinSectorUser(token, sectorId, localUsername, gender) {
try {
const response = await fetch(`${API_BASE_URL}/join`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ sectorId, localUsername, gender })
});
const data = await response.json();
return { ok: response.ok, data };
} catch (error) {
console.error("Netzwerkfehler beim Sektor-Beitritt:", error);
throw error;
}
}