var r = await q.Call('createUser', ['lolsauce', 'abc123'] )
Ive tried passing in:
an object
comma separated list
an array within an object
data:{username:‘abc’, password:‘abc123’}
and a whole lot more.
Im pretty sure Im not passing the arguments right, but also thinking there may be something up with createUser. If you look at that first link, he creates a UDF with the name ‘create_user’
edit2: there does not seem to be any way to call FQL functions / UDFs from the backend. No matter what you pass, its like the UDF just derps out. If I cant find an answer in an hour or 2 Im going to have to look at other solutions.
import { Client, query as q } from 'faunadb'
const client = new Client({
secret: MYSECRET // assuming this has `create` privileges on the User collection
})
client.query(q.Call('create_user', { username: 'jason', password: 'abc1234' } ))
.then(res => console.log(res)) // or do whatever with the response
If you are still getting errors, stringify the WHOLE response.
Also, if you want to inspect what the value of input var is then you can use Abort to inspect it. Update the UDF to something like this: