I am doing an axios post call to graphQL URL. Can I save the response to a variable to use later.
My code:
const myDta = axios.post(
"https://test.test.com/graphql",
{
query: myQuery,
variables: { id: "12345" },
},
{
headers: headers,
}
);
let vals = myDta.then((res) => res.data);
console.log(vals);
I am getting Promise {<pending>}
in my console. How do I fix this?