Trying to make a 404 error logs but getting errors
---
import MainLayout from "../layouts/MainLayout.astro";
import getPage from "request:getPage";
const page = await getPage('/404');
---
<MainLayout seo={page.seo} >
<div class="a-container-regular-2" style="padding-top: 200px">
<center>
<h1>404 page</h1>
<p>Page not found</p>
</center>
</div>
<script is:inline >
const newItem = {
errorType: '404',
errorDescription: 'Page not found',
url: window.location.href
};
const query = `
mutation CreateErrorLog($data: ErrorLogCreateInput!) {
createErrorLog(data: $data) {
id
}
}
`;
const variables = {
data: newItem
};
fetch('https://graphql.datocms.com/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer API-TOKEN-FULL-ACCESS-TO-ERROR_LOG-MODEL`
},
body: JSON.stringify({
query,
variables
})
}).then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
</script>
</MainLayout>
Here is the query
query MyQuery {
errorLog {
_createdAt
errorDescription
errorType
url
}
}
We keep getting this error
[
{
"message": "Schema is not configured for mutations",
"locations": [
{
"line": 2,
"column": 11
}
],
"path": [
"mutation CreateErrorLog"
],
"extensions": {
"code": "missingMutationConfiguration"
}
},
{
"message": "Variable $data is declared by CreateErrorLog but not used",
"locations": [
{
"line": 2,
"column": 11
}
],
"path": [
"mutation CreateErrorLog"
],
"extensions": {
"code": "variableNotUsed",
"variableName": "data"
}
}
]
(Moderator note: Fixed code formatting)