我正在尝试对faunaDB数据库进行突变/查询存储请求。我不确定如何格式化查询以防止错误
import { mutationStore, gql } from "@urql/svelte";
import client from "../client.js";
const loginMutation = gql`
mutation ($email: String!, $password: String!) {
login(email: $email, password: $password) {
secret
ttl
}
}
`;
let login = mutationStore(client, loginMutation, {
email: "shadid12@email.com",
password: "123456"
});
console.log(login);
错误:
Invalid AST Node: [function query]。
Error: Invalid AST Node: [function query].
figure out
<script>
import { mutationStore, gql } from "@urql/svelte";
import client from "../client.js";
const loginMutation = gql`
mutation ($email: String!, $password: String!) {
login(email: $email, password: $password) {
secret
ttl
}
}
`;
let login = mutationStore({
client,
query: loginMutation,
variables: {
email: "security@fauna-labs.com",
password: "qZXUEhaNdng9"
}
});
$: console.log($login);
</script>