remove error in console, and search work with unlog user
This commit is contained in:
@ -10,10 +10,7 @@ export default class extends AbstractView {
|
||||
async wait_get_online_users() {
|
||||
return new Promise((resolve) => {
|
||||
const checkInterval = setInterval(() => {
|
||||
if (client.notice !== undefined &&
|
||||
client.notice.online_users !== undefined &&
|
||||
Object.keys(client.notice.online_users).length > 0) {
|
||||
|
||||
if (Object.keys(client.notice.online_users).length > 0) {
|
||||
clearInterval(checkInterval);
|
||||
resolve();
|
||||
}
|
||||
@ -26,6 +23,10 @@ export default class extends AbstractView {
|
||||
let logged = await client.isAuthentificate();
|
||||
let profiles = await client.profiles.all();
|
||||
|
||||
if (client.notice == undefined || client.notice.online_users == undefined)
|
||||
return console.log("Error");
|
||||
|
||||
await client.notice.getOnlineUser();
|
||||
await this.wait_get_online_users();
|
||||
client.notice.rewrite_usernames = this.rewrite_usernames;
|
||||
|
||||
@ -121,7 +122,12 @@ export default class extends AbstractView {
|
||||
}
|
||||
|
||||
async rewrite_usernames() {
|
||||
let search = document.getElementById("input_user").value.toLowerCase();
|
||||
let search_document = document.getElementById("input_user");
|
||||
|
||||
if (search_document == undefined || search_document == null)
|
||||
return
|
||||
|
||||
let search = search_document.value.toLowerCase();
|
||||
|
||||
let profiles = await client.profiles.all();
|
||||
|
||||
|
@ -10,6 +10,8 @@ async function login()
|
||||
let response = await client.login(username, password);
|
||||
|
||||
if (response.status == 200) {
|
||||
await client.notice.disconnect();
|
||||
await client.notice.connect();
|
||||
navigateTo("/home");
|
||||
} else {
|
||||
let error = await response.json();
|
||||
|
@ -9,6 +9,7 @@ export default class extends AbstractAuthentifiedView
|
||||
|
||||
async postInit() {
|
||||
await client.logout();
|
||||
await client.notice.disconnect();
|
||||
navigateTo("/login")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user