const login = async (email, password) => {
const headers = new Headers();
myHeaders.append("Content-Type", "application/json");
const body = JSON.stringify({ "data": { email, password } });
const requestOptions = {
method: 'POST',
redirect: 'follow'
headers,
body,
};
try {
const response = await fetch("http://test/user/login", requestOptions);
const result = await result.json();
if (!response.ok) {
throw new Error(result.message || 'Something went wrong');
}
const { jwt } = result;
} catch (error) {
console.error(error);
}
};
login(`test@gmail.com`, `test-password`);
const inputs = document.querySelectorAll('input');
for (let i = 0; i < inputs.length; i++) {
const input = inputs[i];
input.addEventListener('input', () => {
input.value = input.value.replace(/[^А-Яа-яЁё\s]/, '');
});
}