How to await ajaxget (or any ajax methods). I have this code:
    
    
    import sugar, json, karax / [kajax, kdom], asyncjs
    
    proc onGetObj(status: int, resp: kstring) =
        let retVal = parseJson($resp)
        echo retVal
    
    proc getObj(sd: string) {.async} =
        await ajaxGet("/api/v1/obj/" & sd & "/", @[state.header], onGetObj)
    
    
    Run

I get an error:
    
    
    Error: type mismatch: got <void>
    but expected one of:
    proc await[T](f`gensym271651: Future[T]): T
    
    
    Run

What is the correct code?

Reply via email to