I have a problem when I try to change value of my variable.
var id = null;
async function getUser() {
let user = document.getElementById('user').value;
let passs = document.getElementById('pass').value;
let res = await eel.login(user, passs)();
let text = res[0];
let id_res = res[1];
if (text == 'Вы успешно авторизовались!') {
window.location.href = 'index.html';
} else if (text == 'Неправильное имя пользователя или пароль') {
alert(text);
}
var copy = $.extend( {}, id );
copy = id_res; // that's my problematic part
alert(id); // allerting updated variable
}
Then, when I try to use "id" variable, it still returns "null".
async function createTask() {
let task = document.getElementById('need_task').value;
let result = await eel.create_task(copy, task);
alert(copy); // got error, that copy is undefined
}
In addition, in my html, I added document.getElementById('btn').addEventListener('click', getUser); and "document.getElementById('but').addEventListener('click', createTask);" to activate my functions.
As you can see, I use python eel library. So I guess, that my mistake is with that eel. I will appreciate any of your hepl!