Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge queries to 1 query #987

Open
Toni-hr98 opened this issue May 26, 2020 · 0 comments
Open

Merge queries to 1 query #987

Toni-hr98 opened this issue May 26, 2020 · 0 comments
Labels

Comments

@Toni-hr98
Copy link

@Toni-hr98 Toni-hr98 commented May 26, 2020

Is it possible to merge the query to 1 request. as an array?

query global($locale:String) {
    cookiemelding: globalSets(handle: "cookiemeldingPlein", siteId: $locale) {
        ... on cookiemeldingPlein_GlobalSet {
            id
            siteId
            avgTekst
            cookiemelding {
                   id
                 title
            }
        }
    }
    footer: globalSets (handle: "footerPlein", siteId: $locale) {
        ... on footerPlein_GlobalSet {
            id
            title
        }
    }
}


export default {
apollo: {
		cookiemelding: {
			query: global,
			variables() {
				return {
					locale: "4"
				}
			}
		},
		footer: {
			query: global,
			variables() {
				return {
					locale: "4"
				}
			}
		}
	},
}

I tried everything, but cant figure it out... i would love to get something like this:

query global($locale:String) {
    cookiemelding: globalSets(handle: "cookiemeldingPlein", siteId: $locale) {
        ... on cookiemeldingPlein_GlobalSet {
            id
            siteId
            avgTekst
            cookiemelding {
                   id
                 title
            }
        }
    }
    footer: globalSets (handle: "footerPlein", siteId: $locale) {
        ... on footerPlein_GlobalSet {
            id
            title
        }
    }
}


export default {
apollo: {
		globals: {
			query: global,
			variables() {
				return {
					locale: "4"
				}
			}
		}
	},
}


vue example:

globals.footer[0].title

or 

globals.cookiemelding[0].title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.