export async function handleLogin(username, password) {
    
    const response = await fetch('http://localhost:8000/api/users/login', {
     method: 'POST',
     credentials:'include',
     headers: {
       'Content-Type': 'application/json',
     },
     body: JSON.stringify
     ({
       email_or_username: username,
       password: password
     })
     
   })
   
   if(response.status === 200)
   {
     window.location.href = '/chat'
     return ""
   }
   else if(response.status === 401)
   {
     return "Неправильный логин или пароль"
   }
   else{
   console.log(response.status)
   }
 }