Accessing draft/updated content

    If you have draft/published mode enabled on some of your models, you can use the https://graphql.datocms.com/preview endpoint to access records at their latest version available, instead of the currently published.

    Both endpoints offer exactly the same queries, the only thing that will change will be the returned content.

    export function request({ query, variables, preview }) {
    const endpoint = preview
    ? `https://graphql.datocms.com/preview`
    : `https://graphql.datocms.com/`;
    const client = new GraphQLClient(endpoint, ...);
    // ...
    }
    // Then in your Vue.js component:
    export default {
    // ...
    async mounted() {
    this.data = await request({
    query: yourQuery,
    preview: true
    });
    }
    }