removed async and moved js to separate file
fixed missing param in onError and reformatted login to work without async