@@ -61,7 +61,13 @@ async function performLogin(authToken) {
|
|||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ auth_token: authToken })
|
body: JSON.stringify({ auth_token: authToken })
|
||||||
});
|
});
|
||||||
const data = await res.json();
|
const text = await res.text();
|
||||||
|
let data;
|
||||||
|
try { data = JSON.parse(text); } catch (e) {
|
||||||
|
errEl.textContent = 'Server returned: ' + text.substring(0, 100);
|
||||||
|
errEl.style.display = 'block';
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (data.status === 'success') {
|
if (data.status === 'success') {
|
||||||
currentUser = data.username;
|
currentUser = data.username;
|
||||||
currentRole = data.role;
|
currentRole = data.role;
|
||||||
|
|||||||
Reference in New Issue
Block a user