I’m attempting to update an old application from scala 2.12.6
and scalajs 0.6.25
up to scala 2.13.12
and scalajs 1.15.0
. The old application used lihaoyi’s autowire + upickle for communication between the js client and jvm server projects (using crossproject).
I’m run into trouble with autowire, in that the normal call:
AjaxClient[AjaxApi].testWithArgs("a test arg").call()
Is not behaving as expected. Instead, I get a compiler error:
value call is not a member of Int
I don’t know enough about the internal structure of autowire to figure much out and looking at the source isn’t helping.
In case it helps, here are the api trait and the client:
Api:
trait AjaxApi
{
def test(): String
def testWithArgs(arg: String): Int
}
Client:
object AjaxClient extends autowire.Client[ujson.Value, Reader, Writer]
{
override def doCall(req: Request) =
{
for {
response <- dom.fetch(
"application/api/" + req.path.mkString("/"),
new RequestInit{
method = HttpMethod.POST
body = write(req.args).toString
}
).toFuture
text <- response.text().toFuture
} yield { text }
}
def write[Result: Writer](r: Result) = write(r)
def read[Result: Reader](p: ujson.Value) = read[Result](p)
}
Autowire was previously version 0.2.6
, upgrading to 0.3.3