asynchronous - Scala how can I return an async string back -


i have login form attempts login users email , password , done in async way. first check if email or password fields blank , if want return back. thing new scala , not know how return string in asynchronous way. code

  def login= action.async {implicit request=>         case class login(password:string,email:string)        val formm = form(mapping(         "email"->text,         "password" -> text)(login.apply)(login.unapply))       val getdata= formm.bindfromrequest.get       val email = getdata.email     var password = getdata.password      var idd = -1;     if (email.isempty() || password.isempty()) {        // how can make ok() return async        ok("empty fields");         }        else   {        val tryout =         sql"""select id,password profiles email=$email , password=$password;""".as[(int,string)]        db.run(tryout).map { result =>         ok(result.tostring())       } } 

my problem ok() in if block how can make return ok() asynchronously ? rest of code works fine.

simply wrap in successful future:

future.successful(ok("empty fields")) 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -